【发布时间】:2021-07-31 09:09:57
【问题描述】:
我有误差线的值,我想在 "ggpubr" 中指定值。 似乎“add”和“error.plot”函数有很多可能性(例如,“mean_sd”),但我找不到任何可以让我自己指定值的东西。 我也试过“geom_errorbar”,但它不能正常工作。 我知道,下次我会使用 ggplot2 来获得灵活性。
示例代码-
df <- data.frame(stringsAsFactors = FALSE, "pse" = c(40, 42, 41, 40, 60, 61, 62, 60, 39, 38, 40, 39, 59, 58, 60, 59 ))
df[1:4,2]="30 cm"
df[5:8,2]="60 cm"
df[9:12,2]="30 cm"
df[13:16,2]="60 cm"
df[1:8,3] = "3.5 cm"
df[9:16,3] = "6.5 cm"
colnames(df)[2]="Size"
colnames(df)[3]="Distance"
my_comparisons <- list( c("Near", "Far"))
ggbarplot(df, x = "Size", y = "pse", fill ="Distance", color = "Distance", ylim=c(25,75), width = 0.6, add = c("mean_se", "jitter"), palette = c("#000000", "#111111"),
position = position_dodge(0.65))+
theme(legend.position = "top")+ theme_bw() + theme(axis.text=element_text(size=14),axis.title=element_text(size=14))+ scale_fill_grey(start=0.8, end=0.95)+ theme(legend.position = "top")+ ylab ("PSE (mm)")[![enter image description here][1]][1]
【问题讨论】: