我正在尝试创建一个 3x4 的 bin 网格,其中包含来自每个 bin 中我的数据的观察计数。我已经完成了一半:
library(ggplot2)
type <- c('daily', 'daily', 'habit', 'habit', 'habit', 'seasonal', 'seasonal', 'year-long', 'year-long', 'year-long', 'year-long', 'year-long')
status <- c('complete', 'incomplete', 'push', 'push', 'incomplete', 'complete', 'complete', 'complete', 'complete', 'push', 'push', 'incomplete')
results <- data.frame(type, status)
ggplot(results) +
geom_dotplot(aes(x=status, y=type), binwidth=.2) +
facet_grid(vars(type))
显然,y 轴现在毫无意义——我不确定是否geom_dotplot
适合使用。geom_histogram
使用or也可以得到类似的结果geom_bar
。
我希望点从每个垃圾箱的左上角开始。这可能吗?我尝试使用该waffle
软件包,但无法弄清楚。理想情况下,每个点都是一个正方形,使用 是不可能的geom_dotplot
,所以如果可以的话,我更愿意使用waffle
。