Skip to content

annotate font setting is ineffective #902

Closed
@mengyuhs

Description

@mengyuhs

设置中文字体

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions