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 中制作无衬线上标或下标文本?


- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01