How do I make sans serif superscript or subscript text in matplotlib?(如何在 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 中制作无衬线上标或下标文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 matplotlib 中制作无衬线上标或下标文本?
基础教程推荐
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- 包装空间模型 2022-01-01
