【发布时间】:2020-07-22 15:58:43
【问题描述】:
这是我的初始条形图代码:
Full %>% ggplot(aes(x = reorder(POS, -Iconicity), y = Iconicity, fill = Group)) +
geom_bar(stat = "summary", position=position_dodge(width = 0.9)) +
scale_fill_viridis_d() + # color-blind compatible colors
theme_minimal() + xlab("POS")
创建了这个可爱的图表:
所以我想把它变成一个棒棒糖图表,让它看起来更整洁、更现代,这就是我使用的代码:
Full %>% ggplot(aes(x = reorder(POS, -Iconicity), y = Iconicity, color = Group)) +
geom_point(size=3, stat = "summary", position=position_dodge(width = 0.9)) +
geom_segment(aes(x=POS,
xend=POS,
y=0,
yend=Iconicity)) +
scale_fill_viridis_d() + # color-blind compatible colors
theme_minimal() + xlab("POS")
但是,这当然不会在正确的位置添加足够的段,而且我似乎无法弄清楚如何更改为代码。我剩下的就是:
显然我在 R 方面还是个新手,所以请原谅我
【问题讨论】:
-
您能否详细解释一下您希望最终的图形是什么样子 - “棒棒糖图表”有点模糊。您能否也请使用 dput() 函数向我们展示您的数据是什么样的。谢谢。