If you enter the code in this post first: https://stat.ethz.ch/pipermail/r-help/2009-May/198791.html
then this post shows an example of how to do it with lattice: https://stat.ethz.ch/pipermail/r-help/2009-May/199146.html but I think there is a bug in grid since similar code does not seem to work with your example of grid graphics generated by ggplot2. On Sun, May 31, 2009 at 9:01 AM, baptiste auguie <[email protected]> wrote: > Dear all, > > > I'm trying to access and modify grobs in a ggplot2 plot. The basic idea for > raw Grid objects I understand from Paul Murrell's R graphics book, or this > page of examples, > > http://www.stat.auckland.ac.nz/~paul/grid/copygrob/copygrobs.R > > However I can't figure out how to apply this to a ggplot (basically I don't > know how to write a syntactically correct gPath), > > > p <- # minimal example > qplot(0,0)+ annotate("text",0,0,label="test") > > g <- # store the plot as a grob > ggplotGrob(p) > > # structure of the grob > grid.ls(g) # rather large! > > # find a particular grob in the gTree > getGrob(g,"texts", grep = T) > > > # next step, modify, say, the colour of these grobs > grid.edit() # what do I put in here? > > > Thanks for any piece of advice, > > baptiste > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.

