[R] scaling axes when plotting multiple data sets
John Fox
jfox at mcmaster.ca
Wed Feb 16 23:27:40 CET 2005
Dear Ben,
On Wed, 16 Feb 2005 17:04:13 -0500
"Benjamin M. Osborne" <Benjamin.Osborne at uvm.edu> wrote:
>
> 1) When adding additional data sets to a plot using "plot" followed
> by "lines",
> is there a way to automate the scaling of the axes to allow for all
> data sets
> to fit within the plot area?
>
Not, to my knowledge, after the fact.
> 2) I attempted to solve this by setting
> xlim=c(min(c(data1,data2,data3)),max(c(data1,data2,data3)))
> however, there are some NAs and Infs in these data sets, and
> min(data1) and
> max(data1) both return NA, as with data2 and data3. (These are time
> series).
>
Specifying, e.g., min(data1, data2, data3, na.rm=TRUE) will get rid of
the NAs, but it's not obvious that Infs should be removed, since if one
is present, shouldn't max be Inf?
If you want to get rid of the Infs, however, you could change them into
NAs, as in data1[data1 == Inf] <- NA, and proceed as above.
I hope this helps,
John
> Thank you,
> Ben Osborne
>
> --
> Botany Department
> University of Vermont
> 109 Carrigan Drive
> Burlington, VT 05405
>
> benjamin.osborne at uvm.edu
> phone: 802-656-0297
> fax: 802-656-0440
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
More information about the R-help
mailing list