5

I've managed to replicate the graphs in:

http://matplotlib.org/xkcd/examples/showcase/xkcd.html

However my font does not look like that. How do I change the text font to the cool xkcd font?

eran
  • 14,496
  • 34
  • 98
  • 144
  • http://stackoverflow.com/questions/25679403/matplotlib-text-wont-display-in-xkcd-font – Barranka Oct 01 '14 at 17:26
  • I have exactly copied the example from the link you provided. I had to upgrade my `matplotlib` version to `1.4.0`. This version includes `xkcd`. The plots resulting from the example are in `xkcd` style and work perfect. – The Dude Oct 01 '14 at 17:55
  • It works for me as well. I asked about the FONT. :) I still get a regular font. – eran Oct 01 '14 at 18:33
  • Please copy-paste into your question the precise program you are running and the resulting image. – Robᵩ Oct 01 '14 at 18:58
  • Possible duplicate of [Getting xkcd plots using matplotlib](http://stackoverflow.com/questions/19663986/getting-xkcd-plots-using-matplotlib) – bastelflp Nov 28 '15 at 21:37

1 Answers1

7

Quoting from the output of >>> help(plot.xkcd):

For best results, the "Humor Sans" font should be installed: it is
not included with matplotlib.
Robᵩ
  • 163,533
  • 20
  • 239
  • 308
  • 5
    Great, thanks! 1. Downloaded the font Humor-Sans.ttf 2. Placed it in /usr/share/fonts/truetype/humor-sans 3. ran `sudo fc-cache -f -v` to refresh the font cache and now it works. – eran Oct 02 '14 at 16:26
  • 2
    And clear the matplotlib font cache after the installation: Win7: `%userprofile%\.matplotlib` Ubuntu: `~/.cache/matplotlib` – bastelflp Nov 28 '15 at 21:38