利用 中的示例包代码ggpubr
,该ggdotchart
函数不会像示例中所示创建单独的段,而是只有一个段,尽管点似乎放置在正确的方向上。有人对可能出现的问题有任何提示吗?我认为这可能是由于 tibbles 与 df 的因素,但我无法确定问题所在。
代码:
df <- diamonds %>%
filter(color %in% c("J", "D")) %>%
group_by(cut, color) %>%
summarise(counts = n())
ggdotchart(df, x = "cut", y ="counts",
color = "color", palette = "jco", size = 3,
add = "segment",
add.params = list(color = "lightgray", size = 1.5),
position = position_dodge(0.3),
ggtheme = theme_pubclean()
)