[R] ggplot2: font size mismatch for pdf output

Michael Friendly friendly at yorku.ca
Mon May 12 16:20:22 CEST 2008


Hi

In the following, the graph I see on the screen and the .png output
coincide.  However, in the .pdf file, the fonts seem to be scaled
fairly larger, resulting in the label for the top legend disappearing.
Is this an infelicity or bug, or is there something I've missed?

More generally, how do I control the size of fonts used in legends
and axis labels?

library(car)
library(ggplot2)

qp <-qplot (education , income , shape=type , size=women , colour=prestige ,
	 xlab="Education" , ylab="Income", data=Prestige)
    + scale_y_continuous(limits=c(NA, 20000))
qp + scale_size(to=c(1,8))

ggsave(file="prestige-ggplot.png", width=6, height=5)  # OK
ggsave(file="prestige-ggplot.pdf", width=6, height=5)  # fonts too large

-Michael



More information about the R-help mailing list