[英]How Can I Increase Space Between Bars With ggplot?
ggplot(G, aes(x=State, y=Score, fill=State))+
geom_bar(stat="identity", position="dodge")+
scale_y_continuous(labels = scales::comma)
請幫助我使閱讀更加優雅。
此輸出 +我想在x中以236的分數使用一行,嘗試了abline(v = 236)
不工作!
試試這個,對我有用
barplot(c(1,2,3,4),space=c(1,1,1,1)) # equally spaced bars as expected
barplot(c(1,2,3,4),space=c(1,20,1,1)) # massive gap before the 2nd bar
barplot(c(1,2,3,4),space=c(20,1,1,1)) # the same as the first plot
有很多酒吧。 您可以通過在geom_bar()
指定其width
來使條變得更窄(按比例,1處於觸摸狀態,0.5等於等量的條和間隙,默認值為0.9)。
ggplot(G, aes(x = State, y = Score, fill = State)) +
geom_bar(stat = "identity", position = "dodge", width = 0.8) +
scale_y_continuous(labels = scales::comma)
另請注意,在您的示例中, position = "dodge"
沒有任何作用。
對於具有許多條形圖的圖,如果您希望將它們全部標記,我建議在圖中添加+ coord_flip()
-通常,垂直空間比水平空間容易,而且長標簽不會重疊。 當您的酒吧超過50個時,您將需要大量空間。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.