Loading packages…
library(dplyr)
library(ggplot2)
library(extrafont)
First, we download the TTF files, defining the Decima WE font, from https://www.download-free-fonts.com, and we put them in the directory ~/.local/share/fonts/. Then, we import them into our R session:
font_import(paths = "~/.local/share/fonts/",prompt = F)
If you use package ggplot2, you can use the font with command
+ theme(text = element_text(family = "Decima WE")).
Here an example:
p <- ggplot(airquality %>% mutate(Temp=cut(Temp,breaks = c((5:10)*10))),
aes(x=Wind,y=Ozone)) + geom_point() +
facet_grid(Temp~Month, labeller = label_both) +
theme_bw()+
theme(
text = element_text(family = "Decima WE", color = "grey20"),
strip.background = element_blank(),
strip.text = element_text(hjust = 0),
panel.grid.major = element_line(colour="grey50",size=0.35),
panel.grid.minor = element_blank(),
plot.margin=unit(c(0,1,0,1),"cm"),
legend.position="top",
plot.caption=element_text(hjust=1,size=9,colour="grey30"),
plot.subtitle=element_text(face="italic",size=12,colour="grey40"),
plot.title=element_text(size=18,face="bold")) +
labs(title="\nAn example",
subtitle="using font Decima WE",
caption="Notes: probably compliant with the new logo font ARPA-FVG\n",
x=expression("wind"~(m/s)),
y=expression("ozone"~(mu*g/m^3)))
p