如何更改包括乳胶零件在内的Matplotlib标签的字体?

发布于 2025-01-31 17:40:19 字数 378 浏览 4 评论 0原文

我正在使用matplotlib绘制图形。由于在报告中使用它,因此我希望字体能够匹配报告本身的字体。我在下面找到了可以更改标签字体的方法,但它不会更改标签的乳胶部分的字体。无论如何是否有更改乳胶字体样式?

import matplotlib.font_manager as fm
prop = fm.FontProperties(fname='/root/Fonts/AdobeDevanagari-Regular.otf')
ax[0].set_ylabel('$\mathrm{\chi}_{v}^{2}$ /-', fontproperties=prop, fontsize = si1)

另外,我希望能够从个人字体中选择,而不是预先构建的字体,因此我导入OTF文件的原因。

I am drawing a graph using Matplotlib. As it is being used in a report I want the fonts to match that of the report itself. I've found this method below which works to change the font of the label but it doesn't change the font of the LaTeX part of the label. Is there anyway of changing the LaTeX font style?

import matplotlib.font_manager as fm
prop = fm.FontProperties(fname='/root/Fonts/AdobeDevanagari-Regular.otf')
ax[0].set_ylabel('$\mathrm{\chi}_{v}^{2}$ /-', fontproperties=prop, fontsize = si1)

Also, I want to be able to pick and choose from personal fonts not the prebuilt in ones hence the reason I imported the otf file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文