0

I have to make the decision based on the 3 plots which mentioned below, I would like to see all 3 plots together instead of seeing separately. Is it possible? How?

Market and Segment generating most profit:

plot1 <- ggplot(SalesTotal,aes(x=SalesTotal$Market, 
                             y=SalesTotal$TotalProfit, fill=SalesTotal$Segment))
plot1 + geom_bar(stat="identity",position="dodge") + 
      xlab("Market") + ylab("Profit") + ggtitle("Total Profit")

Market and Segment having most profit margin:

plot2<-ggplot(SalesTotal,aes(x=SalesTotal$Market,y=SalesTotal$ProfitPercent,fill=SalesTotal$Segment))
plot2+geom_bar(stat="identity",position="dodge")+xlab("Market")+ylab("Profit %age")+ggtitle("Profit percent")

Market and Segment having most profit margin:

plot3<-ggplot(SalesTotal,aes(x=SalesTotal$Market,y=SalesTotal$CVMonthlyProfitPercent,fill=SalesTotal$Segment))
plot3<-plot3+geom_bar(stat="identity",position="dodge")+xlab("Market")+ylab("Coeff. of variance of monthly profit")
plot3+ggtitle("Coeff. of variance in monthly profit Vs. Market Segment")

Please see the screenshot below when I tried using grid.arrange(plot1, plot2, plot3) not sure why plot 1 and plot 2 bars not appearing.

enter image description here

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
  • Welcome to Stack Overflow! Could you make your problem reproducible by sharing a sample of your data so others can help (please do not use `str()`, `head()` or screenshot)? You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to assist you with that. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Oct 14 '18 at 14:45
  • don't use $ in the aes. Might not be the problem here, but causes much grief – Richard Telford Oct 14 '18 at 14:54
  • @RichardTelford I m still getting the same problem even if i removed $ from aes. – wyne thomas Oct 15 '18 at 08:41
  • Without some data to reproduce the problem, there is little anyone can do to help – Richard Telford Oct 15 '18 at 10:03

0 Answers0