Created
June 11, 2020 12:02
-
-
Save willprice/69531bd203e60d4987e65f456c3f3247 to your computer and use it in GitHub Desktop.
List fonts available to matplotlib in a Jupyter notebook http://jonathansoma.com/lede/data-studio/matplotlib/list-all-fonts-available-in-matplotlib-plus-samples/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Snippet from http://jonathansoma.com/lede/data-studio/matplotlib/list-all-fonts-available-in-matplotlib-plus-samples/ | |
# Author: Jonathan Soma | |
import matplotlib.font_manager | |
from IPython.core.display import HTML | |
def make_html(fontname): | |
return "<p>{font}: <span style='font-family:{font}; font-size: 24px;'>{font}</p>".format(font=fontname) | |
code = "\n".join([make_html(font) for font in sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist]))]) | |
HTML("<div style='column-count: 2;'>{}</div>".format(code)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment