Choosing font families and styles under Windows, Mac OS X, and Linux

In this recipe, we will see how to choose font families and styles under the three most popular operating systems, namely, Windows, Mac OS X, and Linux.

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 look at all the basic default fonts available under Windows:

par(mar=c(1,1,5,1)) plot(1:200,type="n",main="Fonts under Windows",axes=FALSE,xlab="",ylab="") text(0,180,"Arial \n(family=\"sans\", font=1)", family="sans",font=1,adj=0) text(0,140,"Arial Bold \n(family=\"sans\", font=2)", family="sans",font=2,adj=0) text(0,100,"Arial ...

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.