[R] Help using gPath

Paul Murrell paul at stat.auckland.ac.nz
Thu Aug 9 16:32:13 CEST 2007


Hi


Emilio Gagliardi wrote:
> Hi everyone,I'm trying to figure out how to use gPath and the documentation
> is not very helpful :(
> 
> I have the following plot object:
> plot-surrounds::
>  background
>  plot.gTree.378::
>   background
>   guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347,
> minor-vertical.segments.349, major-horizontal.segments.351,
> major-vertical.segments.353)
>   guide.gTree.356:: (background.rect.345, minor-horizontal.segments.347,
> minor-vertical.segments.349, major-horizontal.segments.351,
> major-vertical.segments.353)
>   yaxis.gTree.338::
>    ticks.segments.321
>    labels.gTree.335:: (label.text.324, label.text.326, label.text.328,
> label.text.330, label.text.332, label.text.334)
>   xaxis.gTree.339::
>    ticks.segments.309
>    labels.gTree.315:: (label.text.312, label.text.314)
>   xaxis.gTree.340::
>    ticks.segments.309
>    labels.gTree.315:: (label.text.312, label.text.314)
>   strip.gTree.364:: (background.rect.361, label.text.363)
>   strip.gTree.370:: (background.rect.367, label.text.369)
>   guide.rect.357
>   guide.rect.358
>   boxplots.gTree.283::
>    geom_boxplot.gTree.273:: (GRID.segments.267, GRID.segments.268,
> geom_bar.rect.270, geom_bar.rect.272)
>    geom_boxplot.gTree.281:: (GRID.segments.275, GRID.segments.276,
> geom_bar.rect.278, geom_bar.rect.280)
>   boxplots.gTree.301::
>    geom_boxplot.gTree.291:: (GRID.segments.285, GRID.segments.286,
> geom_bar.rect.288, geom_bar.rect.290)
>    geom_boxplot.gTree.299:: (GRID.segments.293, GRID.segments.294,
> geom_bar.rect.296, geom_bar.rect.298)
>   geom_jitter.points.303
>   geom_jitter.points.305
>   guide.rect.357
>   guide.rect.358
>  ylabel.text.382
>  xlabel.text.380
>  title


It would be easier to help if we also had the code used to produce this 
plot, but in the meantime ...


> Could someone be so kind and create the proper call to grid.gedit() to
> access a couple of different aspects of this graph?
> I tried:
> grid.gedit(gPath("ylabel.text.382","labels"), gp=gpar(fontsize=16)) # error


That is looking for a grob called "labels" that is the child of a grob 
called "ylabel.text.382".  I can see a grob called "ylabel.text.382", 
but it has no children.  Try just ...

grid.gedit(gPath("ylabel.text.382"), gp=gpar(fontsize=16))


> I'd like to change the margins on the label for the yaxis (not the tick
> marks) to put more space between the label and the tick marks.  I'd also


Margins may be tricky because it likely depends on a layout generated by 
ggplot;   Hadley Wickham may have to help us out with a ggplot argument 
here ... (?)


> like to remove the left border on the first panel.  I'd like to adjust the


I'd guess you'd have to remove the grob "background.rect.345" and then 
draw in just the sides you want, which would require getting to the 
right viewport, for which you'll need to study the viewport tree (see 
current.vpTree())


> size of the font for the axis labels independently of the tick marks. I'd


That's the one we've already done, right?


> like to change the color of the lines that make up the boxplots.  Plus, I'd


Something like ...

grid.gedit("geom_bar.rect", gp=gpar(col="green"))

...?

Again, it would really help to have some code to run.

Paul


> like to change the margins of the strip labels. If you could show me a
> couple of examples I'm sure I cold get the rest working.
> 
> Thanks so much,
> emilio
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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/



More information about the R-help mailing list