[R] Multiple plots; single x(y) labels

David Winsemius dwinsemius at comcast.net
Thu May 13 18:35:00 CEST 2010


?plot  # ylim

and you need to have the data in a form (before plotting) where you  
can determine the shared max and min for the y limits

On May 13, 2010, at 12:04 PM, Xin Ge wrote:

> Hi All,
>
> Can anyone please help me with getting a single x and y-axis label  
> while
> plotting muliple plots. Here is the code:
>
> par(mfcol=c(2,2))
> plot(x <- sort(rnorm(7)), type = "s", main = "", ylab="", xlab="")
> plot(x <- sort(rnorm(27)), type = "s", main = "", ylab="", xlab="")
> plot(x <- sort(rnorm(47)), type = "s", main = "", ylab="", xlab="")
> plot(x <- sort(rnorm(67)), type = "s", main = "", ylab="", xlab="")

opar <- par(mfcol=c(2,2))
randlist <- list(); randlist[[1]] <- sort(rnorm(7))
randlist[[2]] <- sort(rnorm(27))
randlist[[3]] <- sort(rnorm(47))
randlist[[4]] <- sort(rnorm(67))
lapply(randlist, plot, ylim=c(min(rapply(randlist, min)),  
max(rapply(randlist,max))),
                        type = "s", xaxt="n", main = "", ylab="",  
xlab=""); par(opar)

>
> also, how can remove x-tick lables using plot()?

?par  # xaxt="n"

>
> Thanks,
> Xin
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list