Questions tagged [extrafont]
39 questions
150
votes
7 answers
Changing fonts in ggplot2
Once upon a time, I changed my ggplot2 font using windowsFonts(Times=windowsFont("TT Times New Roman")). Now, I can't get it off of this.
In trying to set family="" in ggplot2 theme(), I can't seem to generate a change in fonts as I compile the MWE…

EngBIRD
- 1,915
- 3
- 18
- 22
46
votes
3 answers
How can I resolve the "No Font Name" issue when importing fonts into R using extrafont?
I have a folder on my Windows desktop (C:\Users\me\Desktop\Fonts) which contains fonts that I would like to import into R using extrafont.
When I try to import the fonts using
library(extrafont)
font_import(paths = "C:/Users/me/Desktop/Fonts",…

David Metcalf
- 664
- 1
- 7
- 13
31
votes
1 answer
Extrafont and ggsave: Characters end up on top of another
I'm currently trying to use Arial.ttf in all my plots. I have found several manuals about fonts online, I'm however running into issues when I try to save the pot via ggsave and the default device.
Minimal working example
I'm running the following…

ChrisK
- 1,216
- 8
- 22
7
votes
1 answer
How to unregister removed fonts from R extrafontdb
I have loaded my fonts using
library(extrafont)
font_import()
When I look at the path using
fonttable()
There are some fonts which does not exist any longer under that path. This creates some problems for me later on. How do I remove/unregister…

MLEN
- 2,162
- 2
- 20
- 36
6
votes
1 answer
How can I check whether a given font has been loaded already using extrafont package in R?
I've written a function to share among colleagues for graphing, and my organization prefers Calibri to the ggplot2 default Arial for the text. If I were the only person who'd be using this function, I would first do this at the top of my script:
…

shirewoman2
- 1,842
- 4
- 19
- 31
6
votes
1 answer
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font width unknown for character 0x20
I would like to use the free font Lato in ggplot2 graphs since the remainder of my R markdown document is set in this font.
The font is installed on my system and available in the Font Book (once only).
All available fonts are loaded with the…

mavericks
- 1,005
- 17
- 42
6
votes
1 answer
Font family won't change in ggplot
My plot works, except I'm not able to get the font family to change. It always stays with the default, even when I can other things to change like color, size, and justification.
Here's my code:
ggplot(data = SeattleJuly17Data,
aes(x = Price,…

Gitai Ben-Ammi
- 61
- 1
- 2
5
votes
0 answers
LM Roman in R Plot (R 4.1.2)
I would like to have the title and axis legend in LM Roman 10 in my R plots, to better integrate them in my LateX text.
I have already tried this solution, but in R 4.1.2 does not work.
The code is the following (citing the answer to the previous…

vevvostar
- 135
- 8
5
votes
1 answer
ggplot with customized font not showing properly on shinyapps.io
I can customize the font in a ggplot with:
library(extrafont)
windowsFonts()
font_import(pattern = "comic", prompt = FALSE)
loadfonts(device = "win")
windowsFonts()
ggplot(mapping=aes(x=seq(1,10,.1), y=seq(1,10,.1))) +
…

symbolrush
- 7,123
- 1
- 39
- 67
5
votes
3 answers
ggsave() does not bolden text, and it changes font of all text instead of just plot title
I'm making a chart in ggplot2 and ggsave() does not do what I expect.
require(ggplot2)
require(showtext)
showtext_auto()
hedFont <- "Pragati Narrow"
font_add_google(
name = hedFont,
family = hedFont,
regular.wt = 400,
bold.wt = 700
)
chart…

Username
- 3,463
- 11
- 68
- 111
4
votes
2 answers
Cannot import fonts into R
I'm aware this issue has been posted on already, but I feel like I've tried most of the solutions without finding any success.
I'm using hrbrthemes to plot my ggplot graphs, and it keeps telling me I don't have the right fonts imported.
I installed…

James
- 463
- 4
- 13
4
votes
1 answer
Installing fonts so that R postscript() device can recognise them
Based on the advice in this post I am trying to get the serif font (or 'family' of fonts) installed into R so that I can save ggplots as .eps files. Though the suggestion provided worked I would like to try to resolve the issue for future…

llewmills
- 2,959
- 3
- 31
- 58
3
votes
0 answers
Using Variable Fonts in R
I wish to use a Windows 10 font (I am using Windows 10 and the font is installed/usable in other applications like Word) in a ggplot.
I am attempting to use the extrafont package.
library(extrafont)
font_import()
loadfonts(device = "win")
Calling…

AWaddington
- 725
- 8
- 18
3
votes
1 answer
Raleway font not recognized by "font_import()" in R
I am currently working in RStudio Version 1.2.5033
I have Raleway ("Raleway.ttf") fully installed on my computer (Windows 10 OS).
When I run through the standard font_import() protocol from the extrafont package, it checks through the majority of…

Joshua Mansfield
- 31
- 2
3
votes
1 answer
extrafont::loadfonts(device = "win") wouldn't work in Rprofile but fine in console
I was trying to follow Will Chase's advice on putting the loadfonts line in the .RProfile file so I can be executed before I customarily load ggplot2. his advice
Somehow I encountered this interesting phenomenon, when I write:
if(interactive())
…

PaulDong
- 711
- 7
- 19