如何解决使用 ggplot 更明显地绘制多个组的 ecdf
我正在努力用两个治疗组很好地绘制经验密度。我的数据是带有 2 个处理组的序数 {1,2,3,4},正如您所看到的,线条严重重叠,看起来不太好。
你有什么想法我可以稍微水平移动一条线,这样我就可以清楚地看到两条线吗?我也尝试绘制虚线,但它们仍然重叠。我的代码如下所示:
ggplot(dat_clean,aes(x = Q3.4,color = Treat)) +
geom_step(aes(y= Q3.4),stat = "ecdf") +
labs(y = "Cumulative Density",x = "") +
scale_x_discrete(limits = c("1","2","3","4"),breaks = c(1,4),labels=c("Very Socially Inappropriate","Socially Inappropriate","Socially Appropriate","Very Socially Appropriate")) +
ggtitle("ECDF - Concert Question") +
scale_color_manual(name = "Treatment Type",labels = c("High Valuation Treatment","Low Valuation Treatment"),values = c("red","blue")) +
theme_bw()
并且数据采用这种形式:
治疗 | Q3.4 | Q4.4 | ... |
---|---|---|---|
1 | 1 | 2 | ... |
2 | 4 | 3 | ... |
1 | 2 | 3 | ... |
... | ... | ... | ... |
感谢您的帮助!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。