2016-03-04 110 views
1

我試圖在ggplot2中產生下面的圖表,但我要求它是一個水平圖而不是垂直圖。我也要求情節變薄。如何解決縱橫比和在ggplot2中應用coord_flip?

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() 

當我申請coord_flip()時,繪圖返回到其原始寬度。 如何翻轉並保留小寬度?

回答

1

沒有重複性的數據,我最好的猜測是通過themecoord_fixed(ratio=0.05)

+0

我相信這個答案是不正確傳遞aspect.ratio。主題的aspect.ratio是指面板的aspect.ratio,而coord_fixed()是指數據的寬高比。 – mb7744

相關問題