Re: [R] (x,y) coordinates for grid.text()

From: David Afshartous <dafshartous_at_med.miami.edu>
Date: Tue, 04 Mar 2008 14:02:01 -0500

Thanks, yes "native" is the right one. The code below now works as desired:

trellis.focus("panel", 1, 1)
grid.text("put text here", x = 1, y = 1.5, default.units = "native")

On 3/4/08 1:44 PM, "Erik Iverson" <iverson_at_biostat.wisc.edu> wrote:

> You want "native" coordinates.  But since you are using lattice (built
> 'on top' of grid), you probably need some additional info, like the name
> of the viewport you want to write to I assume(?), but I can't help you
> with that part.
> 
> 
> David Afshartous wrote:

>> Okay, I see that default.units is set to "npc" and hence the behavior I
>> mentioned. Looking at ?unit, I see the description of various units but it
>> isn't clear which one I need to select to achieve the result I specified
>> earlier. Maybe I'm missing something very basic, but I assume there must be
>> a simple way to add text to an xyplot() at a specified (x,y) coordinate in
>> the units of the plotted points?
>>
>>
>>
>>
>>
>> On 3/4/08 12:18 PM, "hadley wickham" <h.wickham_at_gmail.com> wrote:
>>
>>>>  When using grid.text it seems my supplied (x,y) coordinates are being
>>>>  plotted only in npc (normalized parent coordinates) where (.5,.5) is the
>>>>  center of the graph.  How do I allow (x,y) to be coordinates corresponding
>>>>  to the (x,y) values in the graph?   The examples in ?grid.text seem to do
>>>>  this.  (I think the problem lies in how x and y are defined with respect
>>>> to
>>>>  unit ).   Any help much appreciated.  Sample code below.
>>> Have you read the documentation for grid.text?  You need to read the
>>> description of the default.units argument and then read ?unit.
>>> 
>>> Hadley

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


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. Received on Tue 04 Mar 2008 - 18:58:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Mar 2008 - 19:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive