![](/img/trans.png)
[英]R ggplot2: Points, lines and error bars in plot overlap inconsistently
[英]How to more effectively plot points in ggplot2 by groups if they overlap?
因此,我想使用按组分隔的 ggplot 绘制点,但是因为它们按组功能重叠颜色在视觉上看起来并不那么有效,我已经将 alpha 设置为 0.3。 我还能做什么?
我假设您有以下内容:
df <- data.frame(x = c((1:10)-0.05, 1:10, 1:10), y = c(1:10, 1:20), group = paste('Group', 1:10))
df$group <- factor(df$group, levels = unique(df$group))
ggplot(df, aes(x, y, colour = group), alpha=0.3)+
geom_point()
因此,正如@Duck 所建议的,您可以使用facet_wrap
在单独的图中绘制点,如下所示:
df <- data.frame(x = c((1:10)-0.05, 1:10, 1:10), y = c(1:10, 1:20), group = paste('Group', 1:10))
df$group <- factor(df$group, levels = unique(df$group))
ggplot(df, aes(x, y))+
geom_point()+
facet_wrap(~group)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.