Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R ggplot2 fonts issue

Tags:

r

fonts

ggplot2

I'm trying to get the xkcd fonts working in R with ggplot2. However I'm running into some issues. Here is what I have done so far. 1) Installed the "Humor Sans" font from the xkcd site in the directory ~/.fonts 2) Installed the "extrafont" package. This installation worked smoothly. 3) Load the library

library(extrafont)

However when I try to import the font I get the following error.

> font_import(pattern="Humor Sans")
 Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system.
 Continue? [y/n] y
 Scanning ttf files in /usr/share/fonts/, ~/.fonts/ ...
 Extracting .afm files from .ttf files...
 Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) : 
 arguments imply differing number of rows: 0, 1

Any suggestions on what I could be doing wrong or what else I should be doing? Thanks much in advance

edit: Running ubuntu 12.04

like image 882
broccoli Avatar asked Nov 12 '22 05:11

broccoli


1 Answers

Have you tried:

font_import(paths = "~/.fonts", pattern="Humor Sans")

It does not appear to me that "~/.fonts" is the default font folder for a Mac, so if that is (or is not) your OS, you should include more details when you edit your original question.

like image 152
IRTFM Avatar answered Nov 15 '22 13:11

IRTFM