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 [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Samuel Kemp > Sent: Tuesday, October 09, 2007 4:59 AM > To: [EMAIL PROTECTED] > 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@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. > ______________________________________________ R-help@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.