r - ggplot2:更改 annotation_custom() 的字体大小
问题描述
我使用 annotation_custom() 在我的情节下方添加文本。但是,我无法弄清楚如何减小字体大小。绝望地,我尝试geom_text(size= 8)
了哪个不起作用annotation_custom(size=8)
并且不采用“大小”参数。如何更改 annotation_custom() 的字体大小?
df <- data.frame(x=seq(1:100), y=sort(rexp(100, 2)))
p= ggplot(df, aes(x=x, y=y)) +
geom_point()+
theme(plot.margin = unit(c(1,1,3,1), "cm"))+
ggtitle('Random Plot')
Text1 = textGrob('Additional suggestions:')
p1 = p + annotation_custom(grob = Text1, xmin = 0.2, xmax = 0.2, ymin = -0.3, ymax = -0.3)
gt <- ggplotGrob(p1)
gt$layout$clip[gt$layout$name=="panel"] <- "off"
grid.newpage()
grid.draw(gt)
任何信息都会非常有帮助,非常感谢!
解决方案
推荐阅读
- c++ - C ++删除第一个x元素的有效方法,将第x + 1个元素推到第一个而不改变向量大小
- node.js - 如何在 node.js 中运行 npm install --save-dev
- bash - Bash - 目录名不能用于替换
- kubernetes - 如何从 pod 内部公开 kubernetes 度量服务器 api 以卷曲?
- fortran - 使用openmp在fortran中读取多个netcdf文件
- .net - .NET 应用程序仅在附加调试器时静默崩溃。如何定位故障代码?
- linux - 修改命令“last”的输出
- mysql - MySQL:插入时如何删除重复记录或检查重复记录?
- python-3.x - 找不到输入实体
我收到错误ValueError: Could not find the input entity for . 请阅读https://docs.telethon.dev/en/l
- python - 将值附加到 3D 数组 numpy