matplotlib图中粗体而非粗体字体

时间:2017-09-20 10:59:51

标签: python matplotlib plot fonts

我希望在轴上使用粗体数字,但在python matplotlib图中使用非粗体xy标签和标题。我正在做的是:

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

font = {'family':'Arial','size':45}
mpl.rc('font',**font)
mpl.rc('legend',**{'fontsize':45})
mpl.rc('text',usetex=True)

#mpl.rcParams['text.latex.preamble'] = [r'\boldmath']
mpl.rcParams['text.latex.unicode'] = True
mpl.rcParams['axes.linewidth'] = 2.75
mpl.rcParams['figure.figsize'] = (20.0,15.0)
mpl.rcParams['savefig.bbox'] = 'tight'

x = np.linspace(0,6.28,1000)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,np.sin(x),linewidth=7,linestyle='-',color='r',label=r'$u_{\rm rms}$')
ax.set_xlabel(r'$t$')
ax.set_ylabel(r'$u_{\rm rms}$')
plt.tick_params(axis='x', which='major', pad=10)
plt.legend(loc=1,fontsize='40')
plt.savefig('a.png')
plt.show()

我到处都是大胆的。

enter image description here

0 个答案:

没有答案