【发布时间】:2018-01-08 09:48:45
【问题描述】:
我正在尝试在 R 中绘制一些数据和下面的表格。在 R 中,它看起来不错(图 1),但是,当我导出图片时(图 2),它看起来真的很丑,而且格式不一样。
library(tidyverse)
library(cowplot)
p <- ggplot(iris, aes(Sepal.Length, Petal.Length, col = Species)) + geom_point()
info <- iris %>% group_by(Species) %>% summarise_all(mean)
table_plot <- tableGrob(info, theme = ttheme_default(base_size = 8), rows = NULL)
plot_total <- plot_grid(p, table_plot, nrow = 2, rel_heights = c(4 / 5, 1 / 5))
plot_total
save_plot("iris.png", plot_total)
【问题讨论】:
-
您可以调整图形的尺寸、字体大小等。这对我来说始终是一个迭代过程。我的建议是,如果您的目标是将图形输出为文件(.pdf、.png 等),请在构建图形后立即开始处理文件的版本。屏幕输出是文件输出的不良决定因素。