Created
May 19, 2023 06:12
-
-
Save aladinoster/22baf01a4c7fab1005fcf71e016ca087 to your computer and use it in GitHub Desktop.
Python: Adding Custom Fonts to Matplotlib
This file contains hidden or 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
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