简体   繁体   中英

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM