[R] problem with axis labels

Martin Maechler maechler at stat.math.ethz.ch
Sat Oct 16 21:47:18 CEST 2004


>>>>> "Paul" == Paul Stansell <ps at ph.ed.ac.uk>
>>>>>     on Sat, 16 Oct 2004 19:19:42 +0100 (BST) writes:

    Paul> Dear R users,

    Paul> Below are some R commands which produce a y-axis label
    Paul> that is not wholly in the viewing area of the eps file
    Paul> (or the x11 window).

yes, that has almost nothing to do with the specific device

  > label<-expression(italic(A)==union(italic(H)[italic(i)],i==1,4))
  > postscript("labelBug.eps",onefile=F,height=5,width=5,pointsize=12)
  > plot(1,1,xlab=label,ylab=label) 
  > dev.off()

    Paul> I have tried experimenting with the postscript
    Paul> bounding box, and using such R commands as
    Paul> over(phantom(0),...) but I make the whole y-label
    Paul> visible.

    Paul> Does anyone have any suggestions for how I may fix this. 

yes. You have to use a larger "left" margin (i.e. margin # 2),
see the 'mar' section in  help(par),
and also re-read the part on graphics in the "Introduction to R"
manual.

The following will look better {independently of the device,
postscript, X11, windows,...}:

  label <- expression(italic(A) == union(italic(H)[italic(i)],i==1,4))
  op <- par(mar = .1 + c(5,5,4,1))
  plot(1,1, xlab=label, ylab=label) 
  par(op)# to reset the graphics settings to the defaults

Martin




More information about the R-help mailing list