【发布时间】:2021-06-05 23:59:53
【问题描述】:
当我合并两个geom_points 时,我似乎无法使用show.legend = FALSE 压制图例。单独来看似乎很奇怪,他们工作正常。
Plot 1 with 4 unique shapes using interaction
Plot 3 with both geom_points gives 6 unique shapes when show.legend = FALSE for plot 2
最终,我只想要情节 1 的传说。我已将 theme_bw() 放在它的开头和其他所有内容,但似乎没有任何效果......帮助!我的代码如下,
theme_bw() +
geom_point(data1,
mapping = aes(x = x, y = y, shape = interaction(a, b)),
size = 6,
alpha = 1,
position = position_nudge(ifelse(data1$b == "b1", -0.3, 0.3)),
show.legend = TRUE) +
geom_point(data2,
mapping = aes(x=x, y=y, shape = a),
alpha = 0.6,
size = 2.5,
position = position_dodge(width = 0.15),
show.legend = FALSE) +
labs(x = "x", y = "y") +
scale_x_discrete(labels = c("cond1","cond2", "cond3"))
【问题讨论】:
标签: r ggplot2 plot data-visualization