[R] Setting fontsize in dev.copy2eps
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jan 9 22:59:11 CET 2001
On Tue, 9 Jan 2001, Peter Kleiweg wrote:
> I have a figure on screen with a legend. I want to copy this
> image to EPS, and use:
> dev.copy2eps(file="file1.eps", width=5, height=5)
> The legend that looks OK on screen doesn't look OK in the
> PostScript image: the text extends out of the box.
> I try adding a fontsize command:
> dev.copy2eps(file="file1.eps", width=5, height=5, pointsize=5)
> This options seems to get ignored.
> I try setting cex to a smaller value, replotting the figure, and
> copying the result to EPS. Result: the font is smaller, but so
> is the text. Legend text still expands outside the legend box.
> All works well if I leave out the width and height arguments to
> dev.copy2eps. But then, the figure gets too large, and scaling
> down the figure to a reasonable size when including the figure
> in a document, things like linewidth become to small.
> The only way out of this as I see it (apart from not using
> dev.copy2eps) is to enlarge all objects like linewidths,
> fontsizes, etc. So, when the figure is scaled down (when
> including it in a document, leaving it at its default size at
> the moment of saving with dev.copy2eps), the linewidths and
> fontsize come out OK. This seems a bit drastic. Is it even
> possible to resize all elements? For instance, can I enlarge
> dashpatterns? Is there an easier solution?
Just plotting on a postscript() device? The issue here is that dev.copy
copies the display list, and that has been done with a particular
pointsize. It's a convenience, only. You can set the pointsize, but it
does nothing when re-plotting, as I understand it.
> So, these are my problems:
> 1. I can't seem to set the fontsize with dev.copy2eps
> 2. I don't really want to set the fontsize with
> dev.copy2eps. The fontsize is OK. The legend box is too
That's a font metric mismatch, I think.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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