import matplotlib.pyplot as plt, matplotlib.patheffects as path_effects
1. normal
fig = plt.figure(figsize=(5, 1.5))text = fig.text(.5, .5, 'hello world', ha='center', va='center', size=20)text.set_path_effects([path_effects.Normal()])plt.show()
2. shadow
plt.text(.5, .5, 'hello world', path_effects=[path_effects.withSimpleShadow()])plt.plot([0, 3, 2, 5], lw=5, c='b', path_effects=[path_effects.SimpleLineShadow(), path_effects.Normal()])plt.show()
3. 其他特效
- path_effects.Stroke(linewidth=3, foreground=’black’)