如何使用r中的par函数在同一面板中管理所有图的长度和宽度相等的多个图

时间:2019-05-31 00:45:55

标签: r vegan

我需要使用r代码并排绘制三个图形。我设法使用par函数在同一面板中并排绘制了所有图(行或列),但在不失去图属性的情况下无法管理三个图的相等大小。我使用纯素食包进行了有序化计算。

我有两个附有代码的数字。一个图是所有三个图都在同一面板中,而一个图只有一个图。我已经尝试了标准边距函数的几种组合,但到目前为止还没有运气。我希望所有三个图形在相同的面板中具有相同的长度和宽度。如果可能的话,我希望所有三个图的大小(如图中的单个图)在同一面板中。

> par(mfrow = c(1, 3)) par(cex = 0.6) par(mar = c(3, 3, 0, 0), oma =
> c(1, 1, 1, 1))
> 
> pl1<-ordiplot(ord3d, choices = c(1, 2),cex = 0.5, display ="species" ,
> type = 'n',
>               ylim = c(-2.0,3.0),
>               xlim = c(-2.0,3.0)) points(pl1, what = 'species',col="red",cex=0.5, pch = 19) ordiellipse(ord3d,choices =
> c(1,2),env1$TREATMENT,conf = 0.95,label = F,col=1:4,lwd = 2)
> legend("topright", 
>        legend = "species", 
>        col = "red", 
>        pch = 19, 
>        bty = "o", 
>        pt.cex = 0.5, 
>        cex = 0.5, 
>        text.col = "black", 
>        horiz = F) legend('bottomright',cex=0.5, legend=unique(env1$TREATMENT),title="TREATMENT",col=unique(env1$TREATMENT),lty=1,lwd=1)
> plot(vectfitordsubsetenv1,cex=0.5)
> 
> pl2<-ordiplot(ord3d, choices = c(1, 3),cex = 0.5, display ="species" ,
> type = 'n',
>               ylim = c(-2.0,3.0),
>               xlim = c(-2.0,3.0)) points(pl2, what = 'species',col="red", cex = 0.5,pch = 19) ordiellipse(ord3d,choices =
> c(1,3),env1$TREATMENT,conf = 0.90,label = F,col=1:4,lwd = 2)
> legend("topright", 
>        legend = "species", 
>        col = "red", 
>        pch = 19, 
>        bty = "o", 
>        pt.cex = 0.5, 
>        cex = 0.5, 
>        text.col = "black", 
>        horiz = F)  legend('bottomright',cex=0.5,legend=unique(env1$TREATMENT),title="TREATMENT",col=unique(env1$TREATMENT),lty=1,lwd=1)
> plot(vectfitordsubsetenv1,cex = 0.5)
> 
> pl3<-ordiplot(ord3d, choices = c(2, 3),cex = 0.5, display ="species" ,
> type = 'n',
>               ylim = c(-2.0,3.0),
>               xlim = c(-2.0,3.0)) points(pl3, what = 'species',col="red",cex=0.5, pch = 19) ordiellipse(ord3d,choices =
> c(2,3),env1$TREATMENT,conf = 0.95,label = F,col=1:4,lwd = 2)
> legend("topright", 
>        legend = "species", 
>        col = "red", 
>        pch = 19, 
>        bty = "o", 
>        pt.cex = 0.5, 
>        cex = 0.5, 
>        text.col = "black", 
>        horiz = F) legend('bottomright',cex=0.5,legend=unique(env1$TREATMENT),title="TREATMENT",col=unique(env1$TREATMENT),lty=1,lwd=1)
> plot(vectfitordsubsetenv1,cex = 0.5)

我将感谢您的帮助。我期望所有三个图形在同一面板中具有相同的长度和宽度以及图例enter image description here enter image description here

0 个答案:

没有答案