I'm trying to make groupped bar chart in r but it doesn't work. In other words, i only could get ugly stacked chart which is not enough. I'm giving the screenshots of my data and group chart example which I have created in excel. Sure it is not possible to create a same chart but it's just my idea and close one is enough.
I'm also gonna give the example of visualisation which I have got after the wrote code in r.
Data:
Bar chart that I want to create(close one is enough):
My code
ggplot(PV_cluster1, aes(Years, y= c(MSFT, ATVI, AMOT), group=3)) +
geom_bar(position = "stack", stat = "identity", mapping = aes( y= MSFT, group=1, col="MSFT")) +
geom_bar(position = "stack", stat = "identity",mapping = aes( y= ATVI, group=2, col="ATVI")) +
geom_bar(position = "stack", stat = "identity",mapping = aes( y= AMOT, group=3, col="AMOT"))+
scale_y_continuous(breaks=c(-20, 0, 20, 40, 60, 80, 100)) +
theme_bw() +
labs(title = "Cluster 1 stocks", subtitle = "MSFT, ATVI, AMOT", colour="Stocks", y= "Price Variance")
That's what I got after this code