Created
October 29, 2021 10:08
-
-
Save sagorbrur/99881b214ddef705de570357a7806447 to your computer and use it in GitHub Desktop.
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
import matplotlib.pyplot as plt | |
from matplotlib import font_manager | |
import seaborn as sns | |
font_path = './font/IPAGothic_24302.ttf' # Your font path goes here, as example using jp fonts | |
font_manager.fontManager.addfont(font_path) | |
prop = font_manager.FontProperties(fname=font_path) | |
plt.rcParams['font.family'] = 'sans-serif' | |
plt.rcParams['font.sans-serif'] = prop.get_name() | |
# test | |
data = [('上海', 285), ('杭州', 225), ('北京', 163), ('广州', 136)] | |
sns.barplot(x=[k for k, _ in data], y=[v for _, v in data]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment