How do I set the aspect ratio and apply cop_flip in ggplot2?

I am trying to create the following chart in ggplot2, but I require it to be a horizontal graph, not a vertical one. I also require that the schedule 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 chart returns to its original width. How can I flip the chart and keep a small width?

+1
source share
1 answer

Without reproducible data, it would be aspect.ratio to go through aspect.ratio through theme not in coord_fixed(ratio=0.05)

+1
source

Source: https://habr.com/ru/post/1263971/


All Articles