Skip to content

Instantly share code, notes, and snippets.

@aladinoster
Created May 19, 2023 06:12
Show Gist options
  • Save aladinoster/22baf01a4c7fab1005fcf71e016ca087 to your computer and use it in GitHub Desktop.
Save aladinoster/22baf01a4c7fab1005fcf71e016ca087 to your computer and use it in GitHub Desktop.
Python: Adding Custom Fonts to Matplotlib
from matplotlib import font_manager
font_dirs = ['path/to/font/']
font_files = font_manager.findSystemFonts(fontpaths=font_dirs)
for font_file in font_files:
font_manager.fontManager.addfont(font_file)
# set font
plt.rcParams['font.family'] = 'Comic Sans'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment