# [R] Two graphs, align vertically

squall44 tobias.minder at bluewin.ch
Thu Aug 23 10:56:19 CEST 2007

```Thanks for you answer Uwe,

I have the code "par(mfrow=c(1,2), mar=c(5,3,3,1))" not from the help, but
from an example from the R Graph Gallery. I think the help is rather useless
for beginners (like me), because it does not explain anything and only gives
the commands.

Anyway, I always try first and only then I ask questions, if it is that what
Regards
Tobias

Uwe Ligges wrote:
>
>
>
> squall44 wrote:
>> Hi,
>>
>> I created an ecdf and a boxplot. Now I would like to place the ecdf above
>> the boxplot.
>> But I only managed to align them horizontally. I used this code:
>>
>> #-------------------------------------------
>> par(mfrow=c(1,2), mar=c(5,3,3,1))
>
>
> As in the message before: Please read the help pages more carefully! You
> found par(mfrow), what about reading the help page and switching to
> c(2,1)?
>
> Uwe Ligges
>
>
>> # ecdf
>> library(plotrix)
>> x = c(1.6,1.8,2.4,2.7,2.9,3.3,3.4,3.4,4,5.2)
>> F2.5 <- ecdf(x)
>> plot(F2.5,
>>   verticals= TRUE,
>>   do.p = TRUE,
>>   lwd=3,
>>   ylab = "",
>>   xlab = "",
>>   main = "Figur 2.5 Empirische Verteilfunktion",
>>   xlim = c(1,5.5))
>> abline(h= (0:5)*0.2)
>> staxlab(at=x,labels=paste("X[",1:10,"]",sep=""),nlines=3,top.line=2,
>> line.spacing=1, cex=0.8)
>>
>> #boxplot
>> F26<-boxplot(x,
>>      horizontal=TRUE,
>>      main="Figur 2.6 Der Boxplot",
>>      axes=FALSE,
>>      varwidth=TRUE)
>> #-------------------------------------------
>>
>> Can anyone tell me how I need to change the code to align the two graphs
>> vertically?
>> Tobias
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help