Skip to content

Instantly share code, notes, and snippets.

@ashishraste
Last active March 21, 2024 16:29
Show Gist options
  • Save ashishraste/e4ef570fba4fce30f04ee0a99f47ce00 to your computer and use it in GitHub Desktop.
Save ashishraste/e4ef570fba4fce30f04ee0a99f47ce00 to your computer and use it in GitHub Desktop.
Steps to plot xkcd-style graphs using Matplotlib and Python

System details : Ubuntu 14.04, python-2.7.


  1. Download Humor-Sans ttf font from here.
  2. Place it in /usr/share/fonts/truetype/. For OSx systems, you'd just need to double-click the font file to install.
  3. Run the following commands, to refresh your system's font cache and to delete Maplotlib's font cache.
 sudo fc-cache -f -v
 cd ~/.cache/matplotlib; rm fontList.cache; cd  #for OSx systems, this file resides in ~/.matplotlib/

You can now use Matplotlib's xkcd() function to plot xkcd-style graphs.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment