Choosing fonts for PostScripts and PDFs
The pdf
and postscript
graphic devices in R have special functions that handle the translation of an R graphics font family name to a PostScript or PDF file. In this recipe, we will see how to choose the fonts for these vector formats.
Getting ready
We will only use the base graphics functions for this recipe. So, just open up the R prompt and type in the following code. You might wish to save the code as an R script for later use.
How to do it...
Let's create a PDF of an rnorm()
graph with the title and axis annotations in the Avant Garde font:
pdf("fonts.pdf",family="AvantGarde") plot(rnorm(100),main="Random Normal Distribution") dev.off()
To save the same graph as a postscript file, we use the following code: ...
Get R: Data Analysis and Visualization now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.