2024-05-23 15:49:03 发布
网友
我发现TeX弄乱了我的字体,我的子块yaxis标签的对齐,等等,我觉得必须有一个更容易的方法来获得子脚本和上标的绘图标签。救命啊!
只需在表达式中使用\mathregular{whatever}。
\mathregular{whatever}
例如:
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.text(0.2, 0.7, 'No mathtex') ax.text(0.2, 0.5, 'This superscript $is^{in}$ italics') ax.text(0.2, 0.3, 'While this $\mathregular{is^{really}}$ the same font') plt.show()
有关详细信息,请参见http://matplotlib.org/users/mathtext.html。
我不知道在没有mathtext引擎(或者直接使用乳胶)的情况下,如何使用类似TeX的渲染。但是,如果您的问题真的是关于文本对齐的,那么文本对齐kwargshorizontalalignment、verticalalignment和multialignment可能会有帮助?
horizontalalignment
verticalalignment
multialignment
这里的文档:http://matplotlib.org/users/text_props.html
只需在表达式中使用
\mathregular{whatever}
。例如:
有关详细信息,请参见http://matplotlib.org/users/mathtext.html。
我不知道在没有mathtext引擎(或者直接使用乳胶)的情况下,如何使用类似TeX的渲染。但是,如果您的问题真的是关于文本对齐的,那么文本对齐kwargs
horizontalalignment
、verticalalignment
和multialignment
可能会有帮助?这里的文档:http://matplotlib.org/users/text_props.html
相关问题 更多 >
编程相关推荐