我使用matplotlib打印和times new roman字体。然而,在最新版本中,下标不是在Times New Roman中,而其他文本是在Times New Roman中。外观如下。在
例如,代码是as
import matplotlib as mlp,numpy as np
mlp.rc('font',family='Times New Roman')
import matplotlib.pyplot as plt
fig = plt.figure();
plt.xlabel('N$_{sou}$=20',fontsize=20)
plt.show()
下标“sou”不在Times New Roman中,而“N”在Times New Roman中。在
如何解决这个问题?在
在TeX数学模式下,使用专用的数学字体(通常是您使用的字体的斜体版本)显示数学表达式是标准的。Matplotlib似乎模仿了这种行为。在TeX(或LaTeX)中,可以通过使用mathrm命令来恢复旧字体,该命令在matplotlib中似乎也可以工作,如下所示:
相关问题 更多 >
编程相关推荐