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 ?
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!
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.
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.
monofont: the font used for code and also for R output.
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()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With