使用 ggplot 在 R 中绘制我的数据,不显示误差条须。为什么胡须不显示,修复是什么,以便显示?
(虽然没有必要在 geom_errorbar 中指定“data=...”,但我使用较小的一组数据在较大的一组数据上绘制几个点及其误差线。我在这里简化为仅使用用于所有内容的较小数据框,但希望使此示例接近我打算使用的代码。)
谢谢!肖娜
shapes <- c(1, 19, 15, 1, 0)
names(shapes) <- levels(smallDF$Treatment)
p <- ggplot(data=smallDF, aes(x=pNew, y=diff, group=Treatment))
p <- p + geom_errorbar(data=smallDF, aes(ymin=diff-se,ymax=diff+se),
color="black", width=.3, position=position_dodge(.5))
p <- p + geom_line(size=.3)
p <- p + geom_point(data=smallDF, aes(shape=Treatment),fill="white",
size=2.5)
#p <- p + scale_shape_manual(values=c(1, 19, 15, 1, 0))
p <- p + scale_shape_manual(values=shapes)
p <- p + xlab("Pressure (mmHg)") + ylab("delD (mm)")
p <- p + theme_bw()
p <- p + theme(
legend.position="none" …Run Code Online (Sandbox Code Playgroud)