[R] grid.edit() for ggplot2

baptiste auguie ba208 at exeter.ac.uk
Sun May 31 15:01:43 CEST 2009


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



More information about the R-help mailing list