This question already has an answer here:
- ggplot2: Flip axes and maintain aspect ratio of data 1 answer
Im trying to produce the following chart in ggplot2 but I require it to be a horizontal plot rather than vertical. I also require the plot to be thin.
ggplot(Compositiondata, aes(x=1, y=`Composition`, fill=`Elements`),labels = FALSE)
+ geom_bar(stat="identity",aes(col.axis = "white",labels=FALSE))
+ ggtitle("Title")
+ theme(axis.line=element_blank(), axis.text.x=element_blank(),
axis.ticks.x=element_blank(), axis.title.x=element_blank(),
panel.background=element_blank(), panel.border=element_blank(),
panel.grid.major=element_blank(), panel.grid.minor=element_blank(),
plot.background=element_blank())
+ coord_fixed(ratio = 0.05) +coord_flip()
When I apply coord_flip()
the plot returns to its original width.
How can I flip the plot and retain a small width?