Is there a way to have the distance between label and axis 
adjusted automatically? This is interesting in particular for the 
y-axis, when it is not known in beforehand how many digits the 
numbers will have. It may happen then, that numbers and label 
overlap.

All examples that I found work by estimating the required 
distance manually in beforehand and then providing large enough 
margins, or positioning the label far enough away from the axis.

I have a series of plots, that should be done automatically. They 
have different magnitudes in y-direction. So there is no 
universal estimation that looks good in all cases -- of course I 
can provide a "safety margin", but it looks stupid when there is 
too much space between label and axis.

I tried to use the relative positioning mechanism of frames, 
roughly like this:

  fb <- packGrob(fg,yaxisGrob(vp="dataRegion"),side="left")
  fg <- packGrob(fg,textGrob("y axis label",rot=90),side="left")

But it appears that the true size of the axis is not respected; 
numbers on the axis and the label still may overlap.

Can anyone provide a simple example how to do this right? I would 
favor a solution using the 'grid' package.

Thank you
Lasse

Attachment: pgpIwIkCd2SxC.pgp
Description: PGP signature

______________________________________________
R-help@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.

Reply via email to