Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将grid.draw的结果保存到ggplot对象_R_Ggplot2 - Fatal编程技术网

将grid.draw的结果保存到ggplot对象

将grid.draw的结果保存到ggplot对象,r,ggplot2,R,Ggplot2,我需要帮助保存网格的结果。将绘制到ggplot图形对象 我可以使用网格保存修改ggplot的结果 savepdf("H:\\plot name", width = 36, height = 28) gt <- ggplotGrob(plot1) gt$layout$clip[gt$layout$name=="panel"] <- "off" grid.draw(gt) dev.off() # plot1 is the ggplot object that was amended

我需要帮助保存
网格的结果。将
绘制到ggplot图形对象

我可以使用
网格保存修改ggplot的结果

savepdf("H:\\plot name", width = 36, height = 28)
gt <- ggplotGrob(plot1)
gt$layout$clip[gt$layout$name=="panel"] <- "off"
grid.draw(gt)

dev.off()

# plot1 is the ggplot object that was amended as follows

 plot1 = plot1 + annotation_custom(grob = textGrob("my text", gp=gpar(fontsize=15)),  
                          xmin = this.much, 
                          xmax = this.much, 
                          ymin = -that.much, 
                          ymax = -that.much ) 
savepdf(“H:\\plot name”,宽=36,高=28)

gt为什么不在ggplot2?或
ggsave(“file.pdf”,arrangeGrob(grobs=lappy(字母[1:3],函数(txt)arrangeGrob(ggplot(),bottom=txt)))中使用新的标题功能呢?