[R] plot changes usr?
dwinsemius at comcast.net
Tue Sep 29 02:57:47 CEST 2015
On Sep 28, 2015, at 5:33 PM, Ed Siefker wrote:
> I'm trying to plot() over an existing plot() like this:
>> plot(mpg, hp)
>  9.46 34.84 40.68 346.32
>> plot(mpg, hp, col="red", axes=FALSE, xlim=par("usr")[1:2], ylim=par("usr")[3:4], xlab="", ylab="")
>  8.4448 35.8552 28.4544 358.5456
The default usr ranges are some factor (my hazy memory says 104%) of the range of thex- and y-values unless you specify otherwise. This choice allows round data-points to be displayed at the extremes. Why are you trying to muck with the plot setup? The right way would be to use points().
> For some reason "usr" is changing, and so it's not plotting over the
> existing data in the right place.
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Alameda, CA, USA
More information about the R-help