Book Image

R Graphs Cookbook Second Edition

Book Image

R Graphs Cookbook Second Edition

Overview of this book

Table of Contents (22 chapters)
R Graphs Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 Italic \n(family=\"sans\", font=3)", 
family="sans",font=3,adj=0)
text(0,60,"Arial Bold Italic \n(family=\"sans\", font=4)", 
family="sans",font=4,adj=0)

text(70,180,"Times \n(family=\"serif\", font=1)", 
family="serif",font=1,adj...