Re: [R] Units and dimensions in grid object

From: Sébastien Bihorel <pomchip_at_free.fr>
Date: Thu, 10 Mar 2011 06:41:58 -0500

Dear Paul,

Thank for your reply. I am actually trying to pack a rectGrob within the cell of a grid frame object, but I need to define the width of this rectGrob object using both the width and height of the cell. A code such as the following uses an incorrect syntax, but it best reflects what I am trying to achieve.:

tmp <- packGrob(tmp,
  rectGrob(x=0.5, y=0.5,
    width = min(unit(0.3,'npc-width'),
unit(0.75,'npc-height')),

    height = 0.75)
  width=frame.layout$widths[1],
  height=frame.layout$heights[1],
  row=1,
  col=1)

On Sun, Mar 6, 2011 at 8:49 PM, Paul Murrell <p.murrell_at_auckland.ac.nz>wrote:

> Hi
>
>
> On 5/03/2011 9:37 a.m., Sébastien Bihorel wrote:
>
>> Dear R-users,
>>
>> As far as I understand, when one defines the width of a rectGrob call
>> using
>> a 'npc' unit, the width of the object is proportional to the width of the
>> current viewport. Is there a way to refer to the height (or width) of the
>> viewport when defining the width (or height) of the rectGrob object?
>>
>
> Are you looking for ...
>
> rectGrob(width=unit(1, "npc"))
>
> ... (which is the default anyway) or something else ?
>
> Paul
>
> Thanks
>>
>> Sebastien
>>
>> [[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.
>>
>
> --
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> paul_at_stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/
>

        [[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. Received on Thu 10 Mar 2011 - 11:57:16 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 Thu 10 Mar 2011 - 12:00: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