[R] graphical parameters: margins

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Jan 2 17:44:11 CET 2007


On Tue, 2007-01-02 at 17:02 +0100, Ricardo Rodríguez - Your XEN ICT Team
wrote:
> Hi all,
>  
> Please, while using image() which is the graphical parameter which
> control the space between ylab and the y axis? I do need to write a
> number of relatively long y labels and I am not able the control, if
> possible, this space.
> 
> See the effect I need to avoid...
> 
> http://nvx.environmentalchange.net/@rrodriguez/images/overlapping.jpg
> 
> Thanks for your help,
> 
> Ricardo

Either of these two gives you the answer

> help.search("graphical parameters")
> RSiteSearch("graphical parameters margin")

more specifically, read ?par and in particular, the entry for parameter
'mar' and it's relatives.

You might also need to add the axis label separately from the figure:

opar <- par(mar = c(5,7,4,2) +0.1)
plot(1:10, ann = FALSE) # or plot(1:10, ylab = "")
mtext("label", side = 2, line = 6)
par(opar)

1) opar <- par(mar = c(5,7,4,2) +0.1) creates 7.1 lines on the left of
the plot and saves defaults
2) mtext("label", side = 2, line = 6) displays the axis label on line 6
to push it away from the plot axis. Repeat for other sides...
3) par(opar) resets to the defaults.

HTH

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson                 [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list