showtext_opts {showtext} | R Documentation |
The two versions of this function are equivalent, but the "underscore" naming is preferred.
This function sets parameters that will affect the apprearance of the graphs created with showtext.
showtext_opts(...) showtext.opts(...)
... |
Options to be set, expressed in |
nseg
Parameter to control the smoothness of the outlines
of glyphs, typically used in vector graphics devices
such as pdf()
and svg()
.
It is the number of line segments to approximate
a piece of curve in the glyph. The larger nseg
is,
the smoother text outlines would be, but also with
larger file size for vector graphics. Usually a value
between 5~20 would be enough.
dpi
An integer that gives the resolution
of the device. This parameter is only used in bitmap
and on-screen graphics devices such as png()
and
x11()
, to determine the pixel size of text from
point size. For example, if dpi
is set to 96,
then a character with 12 point size will have a pixel
size of 12 * 96 / 72 = 16
.
Yixuan Qiu <https://statr.me/>
## Not run: ## Set dpi to 200 op = showtext_opts(dpi = 200) png("dpi_200.png", 800, 800, res = 200) par(family = "sans") showtext_begin() set.seed(123) plot(density(rnorm(100))) showtext_end() dev.off() ## Restore old options showtext_opts(op) png("dpi_96.png", 800, 800, res = 96) par(family = "sans") showtext_begin() set.seed(123) plot(density(rnorm(100))) showtext_end() dev.off() ## End(Not run)