一个我无法在网上找到答案的快速问题(或Wickham的书):
ggplot2中size参数的单位是多少?例如,geom_text(size = 10) - 10个单位是多少?
编辑:同样的问题适用于ggsave中的默认单位(高度= 10,宽度= 10)
使用 导出绘图ggsave()时,与在 R studio 中查看和导出绘图时相比,我的 ggplot 的几乎所有元素(尤其是文本)都被放大了。我使用的原因ggsave()是我可以获得出版所需的 300 dpi 和 85mm 宽度。
如何确保ggsave()输出与 RStudio 导出的内容相匹配?
1. RStudio 导出(正确的比例):
2. ggsave() 导出(比例不正确):
3.我的代码
library(ggplot2)
library(cowplot)
library(grid)
# Make plot
fig4 <- ggplot()
# Add Landings lines
fig4 <-
fig4 + geom_line(
data = NorRus,
aes(year, tonnes, color = fishing_entity),
size = 0.75
)
# Change colors.
fig4 <-
fig4 + scale_color_manual(
values = bluesPalette,
name = NULL
)
# adjust y axis labels, remove scientific …Run Code Online (Sandbox Code Playgroud)