[R] How to plot multiple graphs each with multiple y variables

Peter Alspach PAlspach at hortresearch.co.nz
Mon Feb 9 22:55:52 CET 2009


Kia ora Gina

If I understand you correctly, you need to specify mfrow argument as c(1,2) and then make your two calls to plot().  HTH ...

Peter Alspach

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of gina patel
> Sent: Tuesday, 10 February 2009 10:43 a.m.
> To: r-help at r-project.org
> Subject: [R] How to plot multiple graphs each with multiple y 
> variables
> 
> I am new to R and have a problem that I haven't been able to 
> find the answer to in the guides or online.
> 
> I have multiple datasets, D1, D2, D3, D4, D5, D6, D7 and D8, 
> and I would like to produce two plots side by side using 
> mfrow.  The first plot should contain data from D1-D4, the 
> second should contain D5-D8.
> 
> I can plot these separately using the code,
> 
> par(mfrow=c(1,1))
> plot(c(0.000001,1),c(0,100),type="n", xlab="D", ylab="% R", log="x")
>      points(D1$L0,D1$K1_R1,lwd=2, col="blue", )
>      points(D2$L0,D2$K1_R2,lwd=2, col="red", )
>      points(D3$L0,D3$K1_Rt3,lwd=2, col="orange", )
>      points(D4$L0,D4$K1_R4,lwd=2, col="black", )
> 
> or
> 
> par(mfrow=c(1,1))
> plot(c(0.000001,1),c(0,100),type="n", xlab="D", ylab="% R", log="x")
>      points(D5$L0,D1$K2_R1,lwd=2, col="blue", )
>      points(D6$L0,D2$K2_R2,lwd=2, col="red", )
>      points(D7$L0,D3$K2_Rt3,lwd=2, col="orange", )
>      points(D8$L0,D4$K2_R4,lwd=2, col="black", )
> 
> but how can I plot them together?
> 
> Thanks in advance for your help, I appreciate any help you can give. 
> 
> 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> 
> 

The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.




More information about the R-help mailing list