我正在尝试使用 ggplot 为仅以黑白打印的出版物制作带有堆叠条形的条形图。我每个栏都有 6 个堆栈,所以使用scale_fill_grey()
使它看起来很奇怪并且难以阅读。有没有更好、更干净的方法来做到这一点?
这是我的数据:
dput(head(Russets))
structure(list(Variety = structure(c(4L, 4L, 4L, 4L, 4L, 5L), .Label = c("Burbank 2018",
"Norkotah 2018", "Silverton 2018", "Burbank 2019", "Norkotah 2019",
"Silverton 2019"), class = "factor"), Rate = c("1", "2", "3",
"4", "5", "1"), Hollow = c("67", "65", "64", "63", "67", "73"
), Double = c("42", "43", "42", "43", "48", "56"), Knob = c("351",
"391", "362", "348", "357", "371"), AllCWT.AC = c("AVGCWT.AC.0.4",
"AVGCWT.AC.0.4", "AVGCWT.AC.0.4", "AVGCWT.AC.0.4", "AVGCWT.AC.0.4",
"AVGCWT.AC.0.4"), ValueCWT.AC = c(224.92342125, 226.91992125,
226.967565, 237.4482825, 227.80791, 168.32446125), TuberSize = structure(c(1L,
1L, 1L, 1L, 1L, 1L), .Label = c("0-4 oz", "4-6 oz", "6-10 oz",
"10-13 oz", "13+ oz", "Culls"), class = "factor")), row.names = c(NA,
6L), class = "data.frame")
这是我当前的 ggplot:
RussetPlot <-ggplot(data=Russets,aes(x=Rate,y=ValueCWT.AC,group=interaction(TuberSize,Variety),fill=(TuberSize))) +
geom_col(position = "stack",inherit.aes = TRUE) +
facet_wrap(~Variety,nrow=2) +
scale_color_discrete(name = "Tuber Sizes", labels = c("0-4 oz", "4-6 oz", "6-10 oz", "10-13 oz", "13+ oz", "Culls"))
print(RussetPlot)
在此先感谢您的任何建议!