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 中制作无衬线上标或下标文本?
基础教程推荐
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
