2014-12-03 56 views
2

我知道,ggplot()然後ggsave()的組合將創建並保存到硬盤驅動器。ggplot2:直接保存到硬盤

是否有任何機會直接將圖形保存到硬盤驅動器而不先顯示/顯示?

回答

3

您必須將ggplot保存到一個變量,然後在ggsave定義情節,就像這樣:

testplot <- ggplot(mtcars, aes(cyl, qsec)) + geom_point() 
ggsave('test.png', plot = testplot)