如何在使用ggalt::geom_dumbbell
in创建的哑铃图中添加传统图例R
?
这个问题有一个图表图例的答案。如何映射美学以获得侧面/底部点的单独图例?
library(ggalt)
df <- data.frame(trt=LETTERS[1:5], l=c(20, 40, 10, 30, 50), r=c(70, 50, 30, 60, 80))
ggplot(df, aes(y=trt, x=l, xend=r)) +
geom_dumbbell(size=3, color="#e3e2e1",
colour_x = "red", colour_xend = "blue",
dot_guide=TRUE, dot_guide_size=0.25) +
theme_bw()