We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
font_path = 'app/fonts/字体文件-宋体_常规.ttc' font_prop = FontProperties(fname=font_path) my_font = font_prop.get_name() plt.rcParams['font.family'] = my_font plt.rcParams['font.sans-serif'] = my_font plt.rcParams['axes.unicode_minus'] = False
annotate("text", x=school_clazz_size + 0.2, y=school_mean_score, nudge_x=0.2, nudge_y=0, label=f"本校平均\n{school_mean_score}%", size=10, color='black', family=my_font)
findfont: Font family 'SimSun' not found.
The text was updated successfully, but these errors were encountered:
Add fonts like this.
from matplotlib import font_manager as fm font_file = "app/fonts/字体文件-宋体_常规.ttc" fm.fontManager.addfont(font_file)
Then you can use it as family="font-name"
family="font-name"
Sorry, something went wrong.
No branches or pull requests
设置中文字体
font_path = 'app/fonts/字体文件-宋体_常规.ttc'
font_prop = FontProperties(fname=font_path)
my_font = font_prop.get_name()
plt.rcParams['font.family'] = my_font
plt.rcParams['font.sans-serif'] = my_font
plt.rcParams['axes.unicode_minus'] = False
findfont: Font family 'SimSun' not found.
The text was updated successfully, but these errors were encountered: