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

2007-10-10 Thread Alberto Monteiro
Hadley Wickham wrote:
>
>>> Is there any hope that, instead of fin, din, pin, etc someday
>>> we will have fmm, dmm, pmm?
>>
>> Why worry about that, Alberto, when you can use my ammazing function:
>>
>> mm2in(x) return(x/25.4)
>>
>> thus:
>>
>> par(pin=mm2in(126))
> 
> But be sure to use it consistently!
> http://www4.cnn.com/TECH/space/9911/10/orbiter.03/
> 
> ;)
> 
That's why it should not be done _at all_, and all functions
should have SI inputs (unless you are from Liberia, Myanmar, etc).

Alberto Monteiro

__
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.


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

2007-10-10 Thread hadley wickham
On 10/10/07, Jim Lemon <[EMAIL PROTECTED]> wrote:
> Alberto Monteiro wrote:
> > Prof Brian Ripley wrote:
> >
> >>Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
> >> "fin", "mai", "omi", "pin" and "usr" are relevant.
> >>
> >
> > Is there any hope that, instead of fin, din, pin, etc someday
> > we will have fmm, dmm, pmm?
> >
> Why worry about that, Alberto, when you can use my ammazing function:
>
> mm2in(x) return(x/25.4)
>
> thus:
>
> par(pin=mm2in(126))

But be sure to use it consistently!
http://www4.cnn.com/TECH/space/9911/10/orbiter.03/

;)

Hadley


-- 
http://had.co.nz/

__
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.


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

2007-10-10 Thread Jim Lemon
Alberto Monteiro wrote:
> Prof Brian Ripley wrote:
> 
>>Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
>> "fin", "mai", "omi", "pin" and "usr" are relevant.
>>
> 
> Is there any hope that, instead of fin, din, pin, etc someday
> we will have fmm, dmm, pmm?
> 
Why worry about that, Alberto, when you can use my ammazing function:

mm2in(x) return(x/25.4)

thus:

par(pin=mm2in(126))

Jim

__
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.


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

2007-10-09 Thread Greg Snow
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.


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

2007-10-09 Thread Prof Brian Ripley
On Tue, 9 Oct 2007, hadley wickham wrote:

> On 10/9/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
>> On Tue, 9 Oct 2007, Alberto Monteiro wrote:
>>
>>>
>>> Prof Brian Ripley wrote:

 Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
  "fin", "mai", "omi", "pin" and "usr" are relevant.

>>> Is there any hope that, instead of fin, din, pin, etc someday
>>> we will have fmm, dmm, pmm?
>>
>> No.  R is quite capable of scaling by 25.4.
>
> Where did the inches come from?  Is it for compatibility with S-plus?
> I can't imagine that Ross would have used inches by default.

>From S's precursor GR-Z as I recall, from the 1970s.

Note that all the base graphics devices are sized in inches (the pixel 
ones came later and are Guido's or mine), and most of those are Ross's 
doing.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
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.


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

2007-10-09 Thread hadley wickham
On 10/9/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> On Tue, 9 Oct 2007, Alberto Monteiro wrote:
>
> >
> > Prof Brian Ripley wrote:
> >>
> >> Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
> >>  "fin", "mai", "omi", "pin" and "usr" are relevant.
> >>
> > Is there any hope that, instead of fin, din, pin, etc someday
> > we will have fmm, dmm, pmm?
>
> No.  R is quite capable of scaling by 25.4.

Where did the inches come from?  Is it for compatibility with S-plus?
I can't imagine that Ross would have used inches by default.

Hadley

-- 
http://had.co.nz/

__
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.


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

2007-10-09 Thread Prof Brian Ripley
On Tue, 9 Oct 2007, Alberto Monteiro wrote:

>
> Prof Brian Ripley wrote:
>>
>> Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
>>  "fin", "mai", "omi", "pin" and "usr" are relevant.
>>
> Is there any hope that, instead of fin, din, pin, etc someday
> we will have fmm, dmm, pmm?

No.  R is quite capable of scaling by 25.4.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
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.


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

2007-10-09 Thread Ken Knoblauch
Duncan Murdoch  stats.uwo.ca> writes:

> 
> On 10/9/2007 8:16 AM, Alberto Monteiro wrote:
> > Prof Brian Ripley wrote:
> >> 
> >> Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
> >>  "fin", "mai", "omi", "pin" and "usr" are relevant.
> >> 
> > Is there any hope that, instead of fin, din, pin, etc someday
> > we will have fmm, dmm, pmm?
> 
> I don't think so (why mm, not cm or m or km?), but grid allows you to 
> specify the units for most measurements, so one day you may be able to 
> do that in whatever passes for par() by then.
> 
> Duncan Murdoch

For anyone interested, there is a larger selection of units online here,
as well as other places,

http://en.wikipedia.org/wiki/SI_prefix

upon seeing which, I wondered (in the spirit of a google) if 
there was a prefix beyond yotta called lotta?

ken 

-- 
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron France

__
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.


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

2007-10-09 Thread Duncan Murdoch
On 10/9/2007 8:16 AM, Alberto Monteiro wrote:
> Prof Brian Ripley wrote:
>> 
>> Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
>>  "fin", "mai", "omi", "pin" and "usr" are relevant.
>> 
> Is there any hope that, instead of fin, din, pin, etc someday
> we will have fmm, dmm, pmm?

I don't think so (why mm, not cm or m or km?), but grid allows you to 
specify the units for most measurements, so one day you may be able to 
do that in whatever passes for par() by then.

Duncan Murdoch

__
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.


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

2007-10-09 Thread Alberto Monteiro

Prof Brian Ripley wrote:
> 
> Read ?par and the descriptiuon in 'An Introduction to R'.  "din",
>  "fin", "mai", "omi", "pin" and "usr" are relevant.
> 
Is there any hope that, instead of fin, din, pin, etc someday
we will have fmm, dmm, pmm?

Alberto Monteiro

__
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.


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

2007-10-09 Thread Prof Brian Ripley
On Tue, 9 Oct 2007, Samuel Kemp wrote:

> 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)').

You do realise that is specific to the windows() device?  The 
getGraphicsEvent() help does not say what happens on the windows() device 
if 'rescale != "R"', when the 'window' is not simply related to the device 
surface -- so I'll ignore that.

> 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?

Read ?par and the descriptiuon in 'An Introduction to R'.  "din", "fin", 
"mai", "omi", "pin" and "usr" are relevant.

You have only one figure, no outer margins and linear scales.  For your 
example on Linux (after resizing) I got

> par("din")
[1] 9.162549 6.407743
> par("mai")
[1] 1.0407480 0.8366798 0.8366798 0.4285433
> par("pin")
[1] 7.897326 4.530315

which tells me the plot region has corners (0.8366798, 1.0407480) and 
(9.162549-0.8366798, 6.407743-0.4285433)

and

> par("usr")
[1]   0.64  10.36  12.80 207.20

tells me the user coordinates of those corners.  That suffices to do the 
mapping.

>
> 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.
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
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] window (x,y) co-ordinates of datapoints

2007-10-09 Thread Samuel Kemp
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.