2014-02-21 93 views

回答

4

只需在表達式中使用\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() 

enter image description here

更多信息參見http://matplotlib.org/users/mathtext.html

+0

這很好用。謝謝! – Arnold

1

我不知道如何在沒有mathtext引擎(或直接使用LaTeX)的情況下使用類似TeX的渲染方式。但是如果你的問題真的是文本對齊,也許文字對齊kwargs horizontalalignment,verticalalignmentmultialignment會有幫助嗎?

Docs here:http://matplotlib.org/users/text_props.html

相關問題