当使用下标定义xlabel或ylabel时,如何在python中禁用斜体字体

当使用下标定义xlabel或ylabel时,如何在python中禁用斜体字体,python,matplotlib,italic,Python,Matplotlib,Italic,如图中红色边框所示,“World”一词我不想用斜体表示。您可以通过添加字体设置来实现这一点 import matplotlib.pyplot as plt plt.plot() plt.xlabel(r'Production$_{world}$') import matplotlib.pyplot as plt fig = plt.figure(figsize=(4,3),dpi=144) plt.plot() plt.xlabel(r'Production$_\mathrm{world}


如图中红色边框所示,“World”一词我不想用斜体表示。

您可以通过添加字体设置来实现这一点

import matplotlib.pyplot as plt
plt.plot()
plt.xlabel(r'Production$_{world}$')

import matplotlib.pyplot as plt
fig = plt.figure(figsize=(4,3),dpi=144)

plt.plot()
plt.xlabel(r'Production$_\mathrm{world}$')