My purpose is to reproduce this figure [ref] with ggplot2
(author: Hadley Wickham).
Here is my effort based on geom_point
and some ugl
Is this close enough for the reproduction?
To get there, since the first plot is really a histogram, expand your example data back out into one row per observation form, from the count summaries.
df <- tidyr::uncount(df, y)
Then using method = 'histodot'
and bindwidth=1
to get geom_dotplot()
into it's histogram-y form.
And removing the y-axis for aesthetic, because it's fractional gibberish and even the docs say it "isn't really meaningful, so hide it".
ggplot(df, aes(x)) +
geom_dotplot(method = 'histodot', binwidth = 1) +
scale_y_continuous(NULL, breaks = NULL)