matplotlib:path effects

来源:互联网 发布:最短路径算法 最优 编辑:程序博客网 时间:2024/06/06 13:13
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’)

Path effects guide

0 0