r - 我可以在 ggplot2 中使用 Annotate 来填充我的小提琴图吗?
问题描述
我使用 rtruncnorm 和一组数据制作了小提琴图并对其进行了注释。这是我的情节代码:
ggplot(g) +
annotate(geom = "rect", xmin = -Inf , xmax = Inf , ymin = 0, ymax = 1, fill = "red", alpha= 0.4) +
annotate(geom = "rect", xmin = -Inf , xmax = Inf , ymin = 1, ymax = max(g$PGR), fill = "green", alpha= 0.4) +
geom_violin(aes(x=1, y=PGR), fill=NA , color="darkred") +
geom_boxplot(aes(x=1, y=PGR) , width = 0.01) +
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())
并收到了这个情节: 小提琴情节
我想使用注释来填充小提琴图制作的形状。所以我只想对“小提琴”内的区域进行注释。有什么建议么?线索?
谢谢你的帮助 :)
解决方案
推荐阅读
- karate - 空手道报告和空手道日志具有带有测试数据的场景名称
- ios - 按钮单击但没有响应
- bash - 使用 scp 时扩展 bash 数组
- html - 为什么我网站上的某些文本与页面其余部分的加载方式不同?
- visual-studio-code - VSCode 缺少 Emmet 换行与缩写
- sql - SSRS - 数字格式表达式不起作用
- azure-cognitive-search - 索引返回 200 后搜索返回旧记录
- node.js - 使用自签名证书时如何响应 OCSPRequest?
- javascript - Gatsby createResolvers 用于其他数据类型中的数据类型
- flutter - AlertDialog 内容未显示任何文本