[R] changing coordinate systems

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Oct 28 20:47:12 CEST 2004

On Thu, 28 Oct 2004, Greg Trafton wrote:

> Hi, All.  I am working with some eye-tracking data.  I have a graph I
> generate in R with arbitrary plotting commands which I want to
> display.  Then I want to plot the eyetracking data overlayed on it.
> The eye-tracking data is in x-y coordinates on a 640x480 coordinate
> system.  Ideally, what I'd like to do is plot my R graph (e.g.,
> plot(1:10)), and then change the complete coordinate system of the
> whole device to be 640x480.  commands like plot.window() don't work
> because that just changes the coordinate system of the plotable area,
> not the whole device or viewable image (ie, the x labels aren't
> right).
> Any ideas?

?par, especially usr (to set the plot coords) and mai (to remove the 

> plot(1:10)
> par(mai=rep(0,4))
> par(usr=c(0,640,0,480))
> rect(10, 10, 630, 470)

shows the idea

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list