Ok, I know this question has been asked many times, but I do not get this:
I am trying to use the xkcd style in matplotlib on Ubuntu 16.04 LTS 64-bit with python 2.7.12 64-bit and I am using the sample code from matplotlib.org/xkcd/examples (see below), but I still get this !
What else have i done
- install matplotlib (version 2.2.2) via pip
- install xkcd and xkcd script fonts (from ipython / xkcd-font )
- install Humor Sans font (from imkevinxu / xkcdgraphs )
- update font cache database (fc-cache -fv)
- delete ~ / .cache / matplotlib (whole directory)
- Reboot the computer.
- Checked that fonts are in ~ / .cache / matplotlib / fontList.json
Any clues how can I get this to work? I appreciate any hint!
Cheers, Micha
I am using example code from matplotlib.org/xkcd/examples :
from matplotlib import pyplot as plt import numpy as np plt.xkcd() fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') plt.xticks([]) plt.yticks([]) ax.set_ylim([-30, 10]) data = np.ones(100) data[70:] -= np.arange(30) plt.annotate( 'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED', xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10)) plt.plot(data) plt.xlabel('time') plt.ylabel('my overall health') fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.bar([-0.125, 1.0-0.125], [0, 100], 0.25) ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') ax.set_xticks([0, 1]) ax.set_xlim([-0.5, 1.5]) ax.set_ylim([0, 110]) ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT']) plt.yticks([]) plt.title("CLAIMS OF SUPERNATURAL POWERS") plt.show()
Micha source share