[R] scaling axes when plotting multiple data sets
davidr@rhotrading.com
davidr at rhotrading.com
Wed Feb 16 23:37:14 CET 2005
min, max, and range (and many other functions) take the na.rm parameter
to ignore NAs, but the Infs must be removed by hand as far as I know:
dat <- c(data1,data2,data3,data4)
dat <- dat[(dat!=Inf)&(dat!=(-Inf))]
rng <- range(dat, na.rm=TRUE)
then use xlim = rng
-- David Reiner
-----Original Message-----
From: Benjamin M. Osborne [mailto:Benjamin.Osborne at uvm.edu]
Sent: Wednesday, February 16, 2005 4:04 PM
To: r-help at stat.math.ethz.ch
Subject: [R] scaling axes when plotting multiple data sets
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?
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).
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
More information about the R-help
mailing list