有没有办法用一个 ggsave 命令将 ggplot 两次保存为不同的文件格式?例如 plot.pdf 和 plot.png
问问题
79 次
2 回答
4
你可以这样使用mapply()
:
#Code
mapply(function(x) ggsave(x,plot = Yourplot,width = 25, height = 18, units = 'cm'),
x=c('plot.pdf','plot.png'))
于 2020-12-10T14:35:17.250 回答
1
一个选项tidyverse
是
library(purrr)
library(ggplot2)
map(c('plot.pdf', 'plot.png'), ~ ggsave(.x, plot = Yourplot, width = 25,
height = 18, units = 'cm'))
于 2020-12-10T16:01:00.847 回答