当我尝试使用 将 ggplot 保存到新目录时ggsave()
,出现错误。
library(ggplot2)
ggplot(mtcars, aes(x = cyl)) +
geom_bar()
ggsave("current_folder/new_folder/new_plot.png")
产生错误:
Saving 11.3 x 7.32 in image
Error in png_dev(..., res = dpi, units = "in") :
unable to start png() device
In addition: Warning messages:
1: In png_dev(..., res = dpi, units = "in") :
unable to open file 'current_folder/new_folder/new_plot.png' for writing
2: In png_dev(..., res = dpi, units = "in") : opening device failed