使用 ggplot 更明显地绘制多个组的 ecdf

问题描述

我正在努力用两个治疗组很好地绘制经验密度。我的数据是带有 2 个处理组的序数 {1,2,3,4},正如您所看到的,线条严重重叠,看起来不太好。

enter image description here

你有什么想法我可以稍微水平移动一条线,这样我就可以清楚地看到两条线吗?我也尝试绘制虚线,但它们仍然重叠。我的代码如下所示:

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 (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...