Setting fonts for annotations and titles

For most data analysis, we can just use the default fonts for titles. However, sometimes, we might want to choose different fonts for presentation and publication purposes. Selecting fonts can be tricky, as this depends on the operating system and the graphics device. We will see some simple ways to choose fonts in this recipe.

Getting ready

All you need to try out in this recipe is to run R and type the recipe in the command prompt. You can also choose to save the recipe as a script so that you can use it again later on.

How to do it...

The font family and face can be set with the par() command:

par(family="serif",font=2)

How it works...

A font is specified in two parts: a font family (such as Helvetica or Arial) ...

Get R: Data Analysis and Visualization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.