[R-SIG-Mac] use of custom font in pdfs

baptiste auguie ba208 at exeter.ac.uk
Wed Apr 1 13:15:56 CEST 2009


Dear Mac and R users,


I've tried several times without much success to replace the default  
font in the graphs produced in R. Ideally, I would use the Myriad Pro  
font that lives in the font manager (but if there are restrictions,  
any other example would do).

I followed all the help pages in ?Devices, ?quartzFonts, ? 
postscriptFonts, ?Cairo, ?pdf ... including what seems to be a  
slightly out-of-date tutorial on Paul Murrell's webpage and a few  
inconclusive or broken examples in the archives. I'd like to ask if  
Mac users could help me figure out a working example for the following  
task,

- I want a pdf output (whether Cairo, pdf, quartz, postscript + post- 
precessing)

- I use some symbols (integral, greek letters, say) : do they need to  
be from a specific font?

- labels, titles, numbers should all be of the same font family

- I use both grid (ggplot2 and lattice) and base graphics

so the example would be,

> library(ggplot2)
>
> pdf( family = "Myriad Pro")
>
> print( qplot(1,1) + xlab(expression(integral(alpha,beta, infinity))))
>
> dev.off()


Many thanks for any advice,

baptiste


 > sessionInfo()
R version 2.8.0 (2008-10-20)
i386-apple-darwin8.11.1

locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] datasets  stats     grid      graphics  grDevices utils      
methods   base

other attached packages:
  [1] spectra_1.0        baptMisc_1.0       constants_1.0       
ggplot2_0.8.2      reshape_0.8.2      plyr_0.1.3          
proto_0.3-8        latticeExtra_0.5-5
  [9] lattice_0.17-15    fortunes_1.3-5     RColorBrewer_1.0-2



More information about the R-SIG-Mac mailing list