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

Gabor Grothendieck ggrothendieck at gmail.com
Mon Feb 9 22:53:03 CET 2009

```Try something like this where we use the built in data frame anscombe:

opar <- par(mfrow = c(1, 2), no.readonly = TRUE)
matplot(1:11, anscombe[1:4], pch = 1:4, col = 1:4, log = "x", ylab = "Y")
matplot(1:11, anscombe[5:8], pch = 1:4, col = 1:4, log = "x", ylab = "Y")
par(opar)

On Mon, Feb 9, 2009 at 4:43 PM, gina patel <ginapatel1981 at yahoo.com> wrote:
> 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?
>
>
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>
>

```