[R] Box around legends (and postscript?)

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Dec 10 22:49:18 CET 2001



"Michael J. Manning" wrote:
> 
> Hi all
> 
> Humbly begging forgiveness for bothering the list with yesterday's
> lame--arsed question.  Postscript, being a vector graphics file format,
> is, um, resolution independant.  The problem as Peter pointed out was
> with the gimp, which defaults to 100dpi resolution when viewing
> postscript files.
> 
> I have another (lame?) question.  I have noted that when I produce a
> graph with multiple plots (e.g. 2x2 plots on the graphics device)
> where each plot has multiple series and a legend with reasonable
> amounts of text describing the series, the right hand side of the box
> surrounding the legend always seems to be drawn through the legend
> text when I write the output to a postscript file.  The image
> displayed by the x11 device on screen seems fine, with the legend
> box drawn neatly around the legend text.  I have tried altering the
> character size and location of the legend text inside the legend
> function (cex options etc) without success, i.e. although the legend
> box may be drawn neatly on the x11 device on screen, it cuts the
> legend text when the output is written to a postscript file whatever I
> try.

Use the argument text.width, e.g.

 plot(1:10)
 legend(1, 10 , legend="anything") # now more space:
 legend(1, 8, legend="anything", text.width = strwidth("else") * 2)

Uwe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list