[R] ggplot 2 - editing in the "panel_1_1" viewport

Pedro Barros pedro.barros at fao.org
Wed Oct 1 11:57:16 CEST 2008


Hi Paul,
Thanks for the tips. I am using ggplot indeed, but I am trying to "drill
down", and extract several grobs, most of which are gTrees or frames. Until
now, I have more or less managed, but I am having difficulties because I
would like to get at the gTrees that are in each cell of a frame. From a
grid.ls() printout, I managed to discover that these are cellGrobs, but I
cannot find any documentation for these.
So, the more straightforward question would be "If I have a frameGrob, with
several children (in different levels), how can I get the grob that is in
row 2, column 4?". I assume there is a way, but I could not find out how...

Thanks a lot for the great package, BTW!
Pedro

Paul Murrell wrote:
> 
> Hi
> 
> 
> Pedro Barros wrote:
>> Hi All,
>> 
>> I am trying to find out how to access the components of a ggplot plot,
>> and I
>> found this reply from Paul Murrel
>> http://www.nabble.com/navigating-ggplot-viewports-tt14826352.html#a15056223.
>> I tried it, and it works.
>> However, I am trying to develop some functions that will do the drawing
>> "automatically", and usually I will not know the full name of the grob
>> that
>> has the layout vp, like "plot.gtree.76". Is there a way that I can repeat
>> the same process, without going through the grid.ls step?
> 
> 
> Being able to divine the names of grobs (and viewports) is dependent on
> the system being used to name the grobs/viewports.  One approach, taken
> in lattice for viewports, is to provide a function, e.g.,
> trellis.vpname(), that builds a name from salient bits of information,
> e.g., panel numbers.  Another important source of information is
> documentation of the naming scheme, e.g., for ggplot2, Hadley's
> http://had.co.nz/ggplot2/book/grid.pdf
> 
> Paul
> 
> 
>> 
>> Thanks,
>> Pedro
> 
> -- 
> 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/
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/ggplot-2---editing-in-the-%22panel_1_1%22-viewport-tp19726397p19757385.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list