Re: [R] Font quality in base graphics

From: Jeffrey Horner <>
Date: Tue, 15 Jul 2008 10:58:07 -0500

willemf wrote on 07/15/2008 08:42 AM:
> I am attempting to get publication quality graphs using R on Ubuntu. I
> encounter lots of problems in using cex to control font size: for instance
> cex=1.5 results in very blocky characters. I then tried to use res=1200
> while creating a PNG file, hoping that this would solve the problem, but it
> did not. When doing the above, a second problem appeared: the font size
> relative to the graphics decreased drastically. e.g. png("t1.png", res=1200,
> width=1200, height=1200). Is anyone prepared to give me a pointer of where
> to read about precise control over font type and font size in base graphics?
> I have two books on R graphics but this aspect is never treated in detail in
> any of them. Kind regards, willemf.

You may find some help with the Cairo package, which allows one to select desired truetype and opentype fonts using the fontconfig library. Be sure to thoroughly read the CairoFonts and CairoFontMatch help pages to learn how to carefully select your fonts. The benefit of using Cairo is that your png graphics have a better chance of looking exactly like your pdf graphics since Cairo embeds the fonts into the pdf by default.

Knowing which journal you're publishing in and their graphic requirements would be helpful to further solve your problem. Some researchers here at Vanderbilt have had success saving graphics as pdf's (with or without Cairo), then either using gimp or the imagemagic command convert to "upscale" the graphic to a desired dpi setting.




______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 15 Jul 2008 - 18:34:46 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 Wed 16 Jul 2008 - 10:31:54 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive