Created
September 9, 2019 03:39
-
-
Save hongry18/51c16a41e7811197a1484809d8c82d2b to your computer and use it in GitHub Desktop.
using matplotlib custom font in python
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
#!/bin/python | |
import matplotlib as mpl | |
import matplotlib.font_manager as font_manager | |
font_dirs = ['/my/custom/font/dir', ] | |
font_files = font_manager.findSystemFonts(fontpaths=font_dirs) | |
font_list = font_manager.createFontList(font_files) | |
font_manager.fontManager.ttflist.extend(font_list) | |
mpl.rcParams['axes.unicode_minus'] = False | |
mpl.rcParams['font.family'] = 'customFontName' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment