如何在 matplotlib 中制作无衬线上标或下标文本? [英] How do I make sans serif superscript or subscript text in matplotlib?

查看:29
本文介绍了如何在 matplotlib 中制作无衬线上标或下标文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 matplotlib 图中的轴标签中使用下标.使用 LaTeX,我会将其设置为 $N_i$,这给了我斜体衬线字体.我知道我可以使用 mathrm 获得非斜体数学字体.但我想获取默认 matplotlib sans-serif 字体中的文本,以便它与图中的其余文本匹配.有没有不使用乳胶的下标文本的方法?

I want to use a subscript in an axis label in a matplotlib figure. Using LaTeX I would set it as $N_i$, which gives me the italic serif font. I know I can get non-italic mathfont with mathrm. But I would like to get the text in the default matplotlib sans-serif font so it matches the rest of the text in the figure. Is there a way to subscript text without using latex?

推荐答案

使用 mathregular 在 mathtext 之外使用用于常规文本的字体:

Use mathregular to use the font used for regular text outside of mathtext:

$mathregular{N_i}$

查看此处了解更多信息.

这篇关于如何在 matplotlib 中制作无衬线上标或下标文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆