[R] Overlaying Plots

Neil E. Klepeis nklepeis at uclink4.berkeley.edu
Thu Nov 18 04:15:25 CET 1999


Greetings,

Problem Summary:  I am trying to overlay data series by plotting on the
same set of axes, but the ylim and xlim specifications apparently do not
specify the actual limits of the plot.  Is there some way to specify the
x and y limits that I am overlooking?  Or is there a bug?  Or.....

According to V&R (1999, p. 71), one should "use the same xlim or ylim
(or both) setting on each plot...".   Unfortunately, this does not work
in R.  When I enter the following:

> x<-rnorm(1000)
> qqnorm(x,ylim=range(x))
> range(x)
[1] -3.222694  3.253103
> qqnorm(x,ylim=c(-3,3))

...the actual plot y limit is not [-3.222692, 3.253103] or [-3,3].  R
sets the extreme tic marks in the second case, and some other
(seemingly) arbitrary limits in the first case (presumably to fit all
the data on the plot with a bit of a margin).  

I've had to make due with the situation by setting whole numbers as the
limits (e.g., the extreme tic marks):

>par(ann=F,new=T)
>oldylim<-par()$yaxp
>ylim[2] <- oldylim[2]
>ylim[1] <- oldylim[1] 

But this doesn't always work for me and is less than satisfactory.

Please advise.

Thanks,
Neil

-- 
___________________________________________________________
Neil E. Klepeis, School of Public Health, UC Berkeley, USA
http://socrates.berkeley.edu/~nklepeis
http://eetd.lbl.gov/ied/era/exposuremodeling/
nklepeis at uclink4.berkeley.edu
510-848-5827
------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list