[R] Multiple plots; single x(y) labels
David Winsemius
dwinsemius at comcast.net
Thu May 13 18:51:16 CEST 2010
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
More information about the R-help
mailing list