##方法一
ggsave(filename, plot = last_plot(), device = NULL, path = NULL,
scale = 1, width = NA, height = NA, units =c("in", "cm", "mm"),
dpi = 300, limitsize = TRUE, ...)
##方法二
p <- ggplot(...) + ...
pdf('result.pdf',width = 5,height = 10)
p
dev.off()