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

David Winsemius dwinsemius at comcast.net
Thu May 13 19:10:38 CEST 2010


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

> Hi David,
>
> Thanks for your reply. By single x and y-labels I meant something  
> like this:
>
> http://zoonek.free.fr/blosxom//R/2006-08-10_lattice_xyplot_quakes.png
>
> which lattice gives by default. The code you sent doesn't seem to  
> solve the problem, I'm sorry if I havent' explained it clearly before.
>
> Any comments?

Yes. If you want lattice output, then don't use base graphics  
functions!!!!

-- 
David.

>
> Thanks,
> Xin
>
> On Thu, May 13, 2010 at 12:51 PM, David Winsemius <dwinsemius at comcast.net 
> > wrote:
>
> On May 13, 2010, at 12:35 PM, David Winsemius wrote:
>
>
> ?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.
>
> I'm still not sure what a single x-label might mean for such  
> disparate series.
>
> 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="")
>
>
> 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)
>
> A minor refinement:
>
>
> opar <- par(mfcol=c(2,2))
> lapply(randlist, plot, ylim=c(Reduce("min", randlist), Reduce("max",  
> randlist)),
>
>                      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
>
> ______________________________________________
> 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
>
>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list