I need two graphs for below data set.
1) First just one bar shows the NonProm,Promo1,Promo2 with different colors to compare the sales
2) Second one with three different bars for each Promotion again for comparison
data = data.frame(
Promotion =c('NonProm','Promo1','Promo2'),
Sales = c(1616408,95219,92365))
For the second one I did try but I got error message
p<-ggplot(data=data, aes(x=Promotion , y=Sales)) +
geom_bar(width=1) +
scale_y_continuous(expand = c(0,0))
p
"Don't know how to automatically pick scale for object of type function. Defaulting to continuous. Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 0, 5 "
Thank you.
stat=identity
in thegeom_bar()
. Try the following,ggplot(data=data1, aes(x=Promotion , y=Sales)) + geom_bar(stat = "identity", width = 1) + scale_y_continuous(expand = c(0,0))
– mnm