我把一个棒棒糖图放在一起,条件设置在Var1大于1,其中所有FALSE都在左边,颜色用粉红色编码,所有TRUE都在1的右边,用蓝色进行颜色编码。
我想在图表上的气泡旁边添加标签,但我似乎只能在一个方向上使用行geom_text(nudge_x=0.1)
这样做。我可以添加什么来将值放在粉红色气泡的左边,还有一点蓝色的气泡?
附上我目前拥有的情节,这是我正在使用的代码:
ggplot(data = data.in, aes(Var1, Var2, color = Condition, label = Total)) +
geom_segment(aes(x = 1, y = Var2, xend = Var1, yend = Var2), color = "grey50") +
geom_vline(aes(xintercept = 1.00), color = "grey35", size = 1) +
geom_point(size = 6) +
geom_text(nudge_x = 0.1) +
scale_x_continuous(breaks = c(0.20, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6,
1.8, 2.0, 2.2, 2.4, 2.6, 2.8)) +
labs(x = "Var1", y = "Var2") +
theme(axis.text.x = element_text(size = 10, face = "bold"),
axis.text.y = element_text(size = 9),
axis.title.y = element_text(size = 12, face = "bold"),
axis.title.x = element_text(size = 12, face = "bold"),
legend.position = "none",
panel.background = element_rect(fill = "white"),
panel.grid.minor.y = element_line(colour = "grey87"),
panel.grid.major = element_line(colour = "grey87"),
plot.caption=element_text(size = 8))
干杯!