[英]ggplot geombar aesthetics issues
嘗試在ggplot中繪制堆積的條形圖。 很難更改圖例的位置和默認設置所使用的配色方案。
我有一些數據已分解為5列,分別稱為R1,R2,R3,變量,值
stackedCE <- ggplot() +
geom_bar(data= all_melted, stat = "identity", color = "black", aes(x= R2,
y= value, fill=variable, width =0.5)) +
ylab("ratio") +
scale_y_continuous(limits=c(0,100)) +
scale_color_manual(labels=c("Phase 1", "Phase 2"),
values = c("grey34", "grey88")) +
xlab("Time (Days)") +
theme(legend.title = element_blank(), legend.position ="top") +
theme_bw() +
facet_grid(R1 ~ R3, scales="free")
生成的圖有效,但默認顏色不變,圖例標題和標簽保持不變。 任何快速提示將不勝感激。
手動更改主題后, theme_bw()
所有主題元素重置為其默認值。 翻轉順序(將自定義theme()
theme_bw()
),它應該可以工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.