[英]R Violin plots and boxplots together, make fill behave differently only for boxplots
[英]R boxplots closer together
我制作了一個帶有三個箱線圖的 plot。 我想讓箱線圖靠得更近,以便在 x 軸上的值和框之間的值之間有更少的空間。 但我就是不知道怎么做。 有人有想法嗎? 我的代碼:
library(ggplot2)
ggplot(data = groupA1,
mapping = aes(x = reorder(treatment, `mass wetness`, median, na.rm = TRUE), y = `mass wetness`)) +
geom_boxplot(postion = "dodge", width = 0.5, fill = "orange", position = "dodge") + theme_classic() +
labs(x = "Treatment", y = "Mass wetness (%)")
只需將 geom_boxplot 中的 position 參數更改為:
position=position_dodge(x)
其中 x 是一個數字,例如 0.5。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.