

On the contrary, font file is the entity that actually provides the character glyphs. That is to say, only knowing the “font name” is not enough, since they are usually system dependent. The easy way to load font into showtext is by calling font.add(family, regular), where family is the name that you assign to that font (so that later you can call par(family = …) to use this font in plotting), and regular is the path to the font file. If you want to have finer control on which part of the code should use showtext, functions showtext_begin() and showtext_end() will help. If you want to use showtext globally, you can call the function showtext_auto() once, and then all the devices after that will automatically use showtext to render text, as the example in the beginning shows. This example should work on most graphics devices, including pdf(), png(), postscript(), and on-screen devices such as windows() on Windows and x11() on Linux. Legend("topright", legend = c("Truth", "OLS"), col = c("red", "black"), lty = 1) Text(1, 1, expression(paste("True model: ", y = x + 1)), Text(-0.5, 4.5, "This is the outlier", cex = 2, col = "steelblue", Title("Draw Plots Before You Fit A Regression", family = "bell")

Xlab = "X variable", ylab = "Y variable", family = "gochi") Op = par(cex.lab = 2, cex.axis = 1.5, cex.main = 2) # Open a graphics device if you want, e.g. # Tell showtext the resolution of the device, # Automatically use showtext to render text for future devices Font_add_google("Covered By Your Grace", "grace")
