情节" Dotplot" (堆积点)

时间:2017-09-22 23:21:25

标签: r plot ggplot2

我知道R中有一个dotchart函数用于制作一个点图,但它并没有给我提供我想要的东西。我希望情节风格类似于以下内容:

c(8, 12, 10, 16, 6, 25, 21, 15,17, 5, 26, 21, 29, 8, 10, 21, 10, 17, 15, 13)

enter image description here

R中有什么可以做到的吗?

2 个答案:

答案 0 :(得分:4)

字面意思是ggplot2 geom,名为“dotplot”: - )

df <- data.frame(a = c(8, 12, 10, 16, 6, 25, 21, 15, 
                       17, 5, 26, 21, 29, 8, 10, 21, 
                       10, 17, 15, 13))

library(ggplot2)
ggplot(df, aes(a)) + 
    geom_dotplot()

enter image description here

答案 1 :(得分:3)

plotrix包有一个函数

x = c(8, 12, 10, 16, 6, 25, 21, 15, 17, 5, 26, 21, 29, 8, 10, 21, 10, 17, 15, 13)
plotrix::dotplot.mtb(x)

enter image description here