我怎么离开的GGPLOT2

我怎么离开的GGPLOT2

问题描述:

集中我已经cowplot我怎么离开的GGPLOT2

require(cowplot); 
tiff('./solution/AGM2.tiff', height = 18,width = 25, units = 'in',res = 60) 

plot_grid(a28 + theme(axis.title.y = element_text(size =40), 
         axis.title.x=element_text(size =40), 
         axis.text.x=element_text(size =35), 
         axis.text.y=element_text(size =40), 
         title=element_text(size = 30), 
         legend.text=element_text(size = 30)), 
      a33 + theme(axis.title.y = element_text(size =40), 
         axis.title.x=element_text(size =40), 
         axis.text.x=element_text(size =35), 
         axis.text.y=element_text(size =40), 
         title=element_text(size = 30), 
         legend.text=element_text(size = 30)), 
      a61 + theme(axis.title.y = element_text(size =40), 
         axis.title.x=element_text(size =40), 
         axis.text.x=element_text(size =35), 
         axis.text.y=element_text(size =40), 
         title=element_text(size = 30), 
         legend.text=element_text(size = 30)), 
      align = 'h', nrow=2, ncol = 2,hjust=0.5,vjust=0.5) 

dev.off() 

以下命令图表,得到了下面的图

enter image description here

但我想离开这个图集中,特别是图的第三个数字(MUFAt)。有人可以帮帮我吗?

+1

尝试删除nrow和ncol – HubertL

+0

不要工作,男人! –

+0

'tiff('./ solution/AGM2.tiff',height = 18,width = 25,units ='in',res = 60); plot_grid(a61 + theme(axis.title.y = element_text(size = 40) ),axis.title.x = element_text(size = 40),axis.text.x = element_text(size = 35),axis.text.y = element_text(size = 40),title = element_text(size = 30), legend.text = element_text(size = 30)),align ='h',nrow = 2,ncol = 2,hjust = 0.5,vjust = 0.5); dev.off()' – HubertL

使用cowplot你可以安排你的图表,不仅使用一格,而且指定在哪里画使用draw_plot()每个单独的图形:

library(ggplot2) 
library(cowplot) 

# theme is repeated for each plot 
my_theme <- theme(axis.title.y = element_text(size = 40), 
        axis.title.x = element_text(size = 40), 
        axis.text.x = element_text(size = 35), 
        axis.text.y = element_text(size = 40), 
        title = element_text(size = 30), 
        legend.text = element_text(size = 30)) 

# Dummy plots 
g1 <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color = Species)) + 
    geom_point(size = 5, show.legend = F) + 
    my_theme 

g2 <- ggplot(iris, aes(x = Petal.Width, y = Petal.Length, color = Species)) + 
    geom_point(size = 5, show.legend = F) + 
    my_theme 

g3 <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color = Species)) + 
    geom_smooth(show.legend = F) + 
    my_theme 


# tiff(height = 18,width = 25, units = 'in',res = 60) 
png(height = 18,width = 25, units = 'in',res = 60)  

# Use x, y, height and width to customize each plot 
ggdraw() + 
    draw_plot(g1, x = 0, y = .5, height = .5, width = .5) + 
    draw_plot(g2, x = .5, y = .5, height = .5, width = .5) + 
    draw_plot(g3, x = .25, y = 0, height = .5, width = .5) 

dev.off() 

enter image description here

另外,

gridExtra::grid.arrange(ggplot(),ggplot(),ggplot(), 
         layout_matrix=rbind(c(1,1,2,2),c(NA,3,3,NA))) 

enter image description here