fstevens
fstevens

Reputation: 1297

What is the default text size in R base graphics?

I have to write a document and the instructions are really stricts. The text size has to be 7pt inside all figures (axis labels, ticks labels, legends). For some reasons I use the base graphics package and cannot use extra packages like ggplot2. In the options of "graphics" (?par), I only see this cex parameter and derivatives that permit to fix the text size relative to a default size.

What is the default font size of R graphics ?

Upvotes: 7

Views: 4639

Answers (1)

Josh O'Brien
Josh O'Brien

Reputation: 162321

For all of R's graphical devices, the default text size is 12 points but it can be reset by including a pointsize argument to the function that opens the graphical device. From ?pdf:

pointsize: the default point size to be used. Strictly speaking, in bp, that is 1/72 of an inch, but approximately in points. Defaults to '12'.

For example, open a device like this:

## pdf
pdf("plot.pdf", pointsize=7)

## bitmap
bmp("plot.bmp", pointsize=7)

## graphics window on screen
x11(pointsize=7)

## etc., etc.  (See ?Devices for a list of available graphics devices.)

and then, after plotting to it, close it with dev.off().

Upvotes: 6

Related Questions