r - 如何在 R ggplot 中注释马赛克图?
问题描述
我的代码如下:
mtcars_tab <- mtcars %>% count(cyl, gear) # counts the number of gear / cylinder combinations
mtcars_tab %>%
ggplot() +
geom_mosaic(aes(x = product(gear), fill = cyl, weight = n), divider = mosaic("v")) +
xlab("Gear") +
ylab("cyl") +
ggtitle("Distribution of Gears and Cylinders in the mtcars data")
我想在马赛克图的矩形(最好居中)上注释 n 这里。
解决方案
推荐阅读
- vue.js - Vuetify vflex align-self-end 不起作用
- apache-kafka - 是否可以在 Kafka 中创建一个日志压缩主题,其中最旧的值通过压缩保留,用于分析目的?
- python - 除了 __name__ 之外,在 Python 中的程序执行时设置了哪些变量?
- fortran - 使用具有可分配长度的字符变量的 Fortran 程序在编译时总是显示警告
- html - Spring Boot 不检测 css 和图像
- python - Python 3.6 环境:ImportError:没有名为 http.client 的模块
- flutter - 在颤振中将数据添加到本地存储
- python - 检查 SharePoint 中的文件是否已完成上传
- javascript - 如何获取 div 中的所有 id 名称
- php - PHP睡眠并广播到频道