xkcd and matplotlib
Hi guys. Attempting to use the xkcd graphics feature that has been recently added to matplotlib from within sagemath.
import matplotlib.pyplot
matplotlib.pyplot.xkcd()
plot(sin(x),(x,-pi,pi),ticks=pi/4,tick_formatter=pi)
Matplotlib throws the following warning:
/home/joal/bin/sage-6.2/local/lib/python2.7/site-packages/matplotlib-1.3\ .1-py2.7-linux-x86_64.egg/matplotlib/font_manager.py:1236: UserWarning: findfont: Font family ['Humor Sans', 'Comic Sans MS'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext]))
I have installed Humor Sans.ttf onto the main system, and into the directory:
/home/joal/bin/sage-6.2/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/mpl-data/fonts/
... but don't know how to reset the matplotlib font cache so matplotlib will pay attention to the new font.
[EDIT]
Okay, seem to have part of the solution - need to verify on a Linux machine this weekend.
EDIT of EDIT
The tricks below don't work on LinuxMint.
The font is recognised in the virtualbox image if it is dumped into:
sage-6.2/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/mpl-data/fonts/
and renamed Humor-Sans.ttf
Then you need to create a .matplotlib folder in the user directory.
mkdir ~/.matplotlib
The concern is that it now that Humor Sans is used for text font, but not for the numbers on the horizontal and vertical axes. Any suggestions, sagers?
[EDIT]
Which turns out to be a consequence of using the pi tick_formatter.