Skip to content

ggplot 2 - editing in the "panel_1_1" viewport

3 messages · Pedro Barros, eric, Hadley Wickham

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

Thanks,
Pedro
#
Not an answer, but, I hope, more of an almost-the-same question...

I want to divide up the text grobs for the key labels into two 
different (text) grobs (each) and put them back into the space occupied 
by the original text grob. I've worked with grobs enough to think this 
should be easy, but I just cannot figure out how to identify the 
specific text grobs to replace on an arbitrary graph from the output of
grid.ls(viewports = TRUE).

Thanks,
Eric


----- Original message -----
From: "Pedro Barros" <pedro.barros at fao.org>
To: r-help at r-project.org
Date: Mon, 29 Sep 2008 08:46:07 -0700 (PDT)
Subject: [R]  ggplot 2 - editing in the "panel_1_1" viewport


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?

Thanks,
Pedro
#
Hmmm, it looks like it isn't possible at the moment.  I'll add a note
to my to do to give the strip grobs better names so that you can pull
out individuals more easily.

Hadley