Q:

How to draw a stacked dotplot in R?

Here is a plot ,how can i draw it in R?

A:

The base R function is stripchart. A minimal example A worked out example:
set.seed(1); A <- sample(0:10, 100, replace = TRUE)
stripchart(A, method = "stack", offset = .5, at = .15, pch = 19, 
           main = "Dotplot of Random Values", xlab = "Random Values")

You can also play with offset to increasing the gap between the stacked points, and pch to change the point type.

A:

library(ggplot2)
ggplot(mtcars, aes(x = mpg)) + geom_dotplot()

