轴的粗体和斜体标签
Bold and italic label of axis
这个x怎么写成xlabel的粗斜体?
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
plt.rcParams['text.latex.preamble']=[r"\usepackage{lmodern}"]
params = {'text.usetex' : True,
'font.size' : 14,
'font.family' : 'lmodern',
'text.latex.unicode': True,
}
plt.rcParams.update(params)
fig, ax = plt.subplots()
ax.annotate('x', xy=(0.93, -0.01), ha='left', va='top', xycoords='axes fraction', weight='bold', style='italic')
plt.show()
添加 from matplotlib import rc
没有帮助。
使用普通文本
使用weight
和style
参数:
ax.annotate("x", ..., weight='bold', style='italic')
使用 Latex
即当 rcParams["usetex"] = True
、
ax.annotate(r'\textbf{\textit{x}}', ...)
这个x怎么写成xlabel的粗斜体?
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
plt.rcParams['text.latex.preamble']=[r"\usepackage{lmodern}"]
params = {'text.usetex' : True,
'font.size' : 14,
'font.family' : 'lmodern',
'text.latex.unicode': True,
}
plt.rcParams.update(params)
fig, ax = plt.subplots()
ax.annotate('x', xy=(0.93, -0.01), ha='left', va='top', xycoords='axes fraction', weight='bold', style='italic')
plt.show()
添加 from matplotlib import rc
没有帮助。
使用普通文本
使用weight
和style
参数:
ax.annotate("x", ..., weight='bold', style='italic')
使用 Latex
即当 rcParams["usetex"] = True
、
ax.annotate(r'\textbf{\textit{x}}', ...)