r - ggplot 误差条出现在 y 轴的每个位置
问题描述
你好我想在我的情节中添加错误栏,
但它添加了多个单色错误栏。我只想为 4 个数据点中的每一个添加误差线。
Sex=as.factor(dromedar$sex)
Posture=as.factor(dromedar$posture)
item= dromedar$itemValue
sd_item= sd(item)
carePlot<-(ggplot() + aes(x = Posture, color = Sex, group = Sex, y = item) +
stat_summary(fun.y = mean, geom = "point") +
stat_summary(fun.y = mean, geom = "line") +
coord_cartesian(ylim = c(0.5, 7.5)) +
#Following line makes the difference between the plots
geom_errorbar(aes(ymin=item-sd_item, ymax=item+sd_item), width=.2) +
labs(title = "Medical Leader", x="Physician's posture") +
ylab("Medical Leader ratings") +
scale_y_continuous(breaks=seq(0,8,1))+
scale_color_discrete(name = "Sex of physician", labels = c("female physician", "male physician"))
)
carePlot
解决方案
推荐阅读
- android - Android Text To Speech - 突出显示口语
- java - 如何使条件StringUtils小于Java中的特定字符
- mongodb - 无法使用 MongoDB 更新嵌套对象值
- php - 如何修复php非法偏移错误
- java - Android studio-未能下载内容
- shopify - Shopify:如何在结账时使用 Bing 转化跟踪 (UET)?
- python - Django/Python Where to find a list of available filter functions when querying
- javascript - 如何防止搜索框崩溃?
- java - @ConditionalOnBean 不适用于手动注册的 bean
- php - 优化执行 3 个计数和分组的 MySQL 查询