我正在尝试使用 R 从 Tableau 中重现这样的简单华夫饼图:
我不确定在waffle
包装中是否可行,但是我非常感谢在两种情况下的任何帮助:
- 有没有办法按行(如 Tableau 示例)而不是按列填充华夫饼图?
- 是否可以在华夫饼图中添加标签百分比 (24%)?
到目前为止,这是我的尝试:
library(waffle)
# dummy sample
basedata <- c('User'=24, 'Not User'= 76)
# Waffle chart
waffle(
basedata,
rows = 10 ,
colors = c("#636363", "#fee8c8"),
xlab = "1 square == 1%"
) +
ggtitle("Some tilte") +
theme(
plot.title = element_text(hjust = 0.5, size = 27, face = "bold"),
legend.text = element_text(size = 15),
legend.position = "bottom"
)