在添加徽标后,我希望使用该功能保存ggplot2
下面的图表ggsave
# Load packages and dataset
library(ggplot2)
library(magick)
data(mpg, package="ggplot2")
# Load a logo from Github
logo <- image_read("https://jeroen.github.io/images/frink.png")
# Plot Code
ggplot(mpg, aes(cty, hwy)) +
geom_count(col="tomato3", show.legend=F)
# Add logo to plot
grid::grid.raster(logo, x = 0.04, y = 0.03, just = c('left', 'bottom'), width = unit(1, 'inches'))
但是,当我尝试使用 保存绘图时ggsave
,它会保存不带徽标的绘图。有什么办法可以克服这个问题并使徽标出现在保存的图像中?
ggsave('Plot.tiff',width =10,height = 6, device = 'tiff', dpi = 700)