Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 203
fstevens Avatar asked Feb 05 '13 16:02

fstevens


People also ask

What is the default text size?

The body text size in Material Design is 14sp. You should think of this as the normal font size, and basically everything else a variation on it. For instance, while 14sp is the default text size when the text can be quite long, when there's only a small modal with a bit of text, it's 16sp!

How do I change the font size in base R?

Go to the menu in RStudio and click on Tools and then Global Options. Select the Appearance tab on the left. Again buried in the middle of things is the font size. Change this to 14 or 16 to start with and see what it looks like.

What is the default font in Ggplot?

R and ggplot can create fantastic graphs, but the default Arial/Helvetica font is too boring and standard. You can change the font used in a plot fairly easily three different ways: All of the built-in ggplot themes have a base_family argument for setting the overall font family for the plot.

What font is R output?

monofont: the font used for code and also for R output.


1 Answers

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().

like image 98
Josh O'Brien Avatar answered Oct 18 '22 06:10

Josh O'Brien