[R] scaling axes when plotting multiple data sets

Spencer Graves spencer.graves at pdf.com
Wed Feb 16 23:28:47 CET 2005


      I just did "?min" and found an argument na.rm, which when TRUE 
causes "min" to ignore NAs.  Also, "See Also" for "?min" mentions 
"range", which returns a 2-vector consisting of both min and max.  The 
function "range" also accepts the na.rm argument.  AND the documentation 
for "range" includes a simple example that seems to demonstrate exactly 
what you are requesting here. 

      hope this helps. 
      spencer graves

Benjamin M. Osborne 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?
>
>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
>
>  
>




More information about the R-help mailing list