Why is my font showing up in fonts() but not loadfonts()?

114 views Asked by At

I'm having trouble with the ggsave() function due to what is likely a font-related issue.

When I try to run ggsave:

ggsave("new_plots/figure_1.pdf",
   height = 3.7,
   width = 6)

I get the following error message:

Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : invalid font type

I've installed the custom font "Gotham", and have imported it with the extrafont package. It shows up in the console when I run "fonts()". However, when I try to load it for PDF use with loadfonts(device = "PDF"), it does not figure on the list.

Any ideas as what to do?

These are my theme settings:

theme_idh <- 
theme_minimal() +
theme(panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.ticks = element_line(colour = "grey80"),
    text = element_text(family = "Gotham"),
    axis.line = element_line(colour = "grey80")
    )
theme_set(theme_idh)
0

There are 0 answers