我的目的是用(作者:Hadley Wickham)重现这个数字[参考]ggplot2.
这是我的努力基础geom_point和一些丑陋的数据准备(参见下面的代码):
我怎么能这样做geom_dotplot()?
在我的尝试中,我遇到了几个问题:(1)将geom_dotplot生成的默认密度映射到计数,(2)将轴切断,(3)没有意外的漏洞.我geom_point()反而放弃了.
我期望(并且仍然希望)它会如此简单
ggplot(data, aes(x,y)) + geom_dotplot(stat = "identity")
Run Code Online (Sandbox Code Playgroud)
但不是.所以这就是我尝试过的和输出:
# Data
df <- structure(list(x = c(79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105), y = c(1, 0, 0, 2, 1, 2, 7, 3, 7, 9, 11, 12, 15, 8, 10, 13, 11, 8, 9, 2, 3, 2, 1, …Run Code Online (Sandbox Code Playgroud)