Re: [R] Legend problem when exporting a plot to PDF

From: Philipp Pagel <p.pagel_at_wzw.tum.de>
Date: Tue, 29 Apr 2008 13:49:01 +0200

> When exporting to PDF a graph with a legend, in the final PDF, the
> text is going beyond the legend box.
> > dev2bitmap("test.pdf", type="pdfwrite", h=6, w=6)
> The legend looks OK on the screen. I noticed that the size of the
> legend box depends on the size of the screen window,

As far as I remember, te problem has to do with different font handling in different devices. I'm sure someone more familiar wiht the internals will comment on this.

The fix is easy: don't use dev2bitmap but open the desired target device before plotting. In your case:

pdf(file='test.pdf', width=6, height=6)
plot(...)
legend(...)
dev.off()

cu

        Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
 
 and
 
Institut für Bioinformatik und Systembiologie / MIPS
Helmholtz Zentrum München -
Deutsches Forschungszentrum für Gesundheit und Umwelt
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
R-help_at_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.
Received on Tue 29 Apr 2008 - 12:06:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Apr 2008 - 14:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive