[R] window (x,y) co-ordinates of datapoints

Greg Snow Greg.Snow at intermountainmail.org
Tue Oct 9 22:59:40 CEST 2007


Look at the cnvrt.coords function in the TeachingDemos package, it does
this type of thing for you.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Samuel Kemp
> Sent: Tuesday, October 09, 2007 4:59 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] window (x,y) co-ordinates of datapoints
> 
> Hi,
> 
> In the getGraphicsEvent function the (x,y) co-ordinates 
> returned from the mouse move are in relation to where the 
> mouse is located within the device window  (i.e. the lower 
> left corner of the window is '(0,0)',  the upper right is 
> '(1,1)'). Is there a way of returning the (x,y) co-ordinates 
> of data points plotted where instead of x and y being the 
> actual data points they are the coordinates of the device window.
> 
> e.g. below is a simple plot of x,y data
> 
> x <- 1:10
> y <- x*20
> plot(x,y)
> 
> > x[4]
> 4
> 
> > y[4]
> 80
> 
> what I actually want to know is where (x[4],y[4]) is within 
> the device window.
> 
> Does any-one have any ideas?
> 
> Thanks in advance,
> 
> Sam
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list