As silvado mentions in his comment, you can use LaTeX rendering for more flexible control of the text rendering. See here for more information: http://matplotlib.org/users/usetex.html
An example:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
# activate latex text rendering
rc('text', usetex=True)
x = np.arange(10)
y = np.random.random(10)
z = np.random.random(10)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y, label = r"This is extbf{line 1}")
ax.plot(x, z, label = r"This is extit{line 2}")
ax.legend()
plt.show()
Note the 'r' before the strings of the labels. Because of this the will be treated as a latex command and not interpreted as python would do (so you can type extbf
instead of \textbf
).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…