|
5 | 5 |
|
6 | 6 | """ |
7 | 7 | import matplotlib.pyplot as plt |
8 | | -import matplotlib.patheffects as PathEffects |
| 8 | +from matplotlib import patheffects |
9 | 9 | import numpy as np |
10 | 10 |
|
11 | 11 | plt.figure(figsize=(8, 3)) |
|
15 | 15 | arrowprops=dict(arrowstyle="->", |
16 | 16 | connectionstyle="angle3", lw=2), |
17 | 17 | size=20, ha="center", |
18 | | - path_effects=[PathEffects.withStroke(linewidth=3, |
| 18 | + path_effects=[patheffects.withStroke(linewidth=3, |
19 | 19 | foreground="w")]) |
20 | 20 | txt.arrow_patch.set_path_effects([ |
21 | | - PathEffects.Stroke(linewidth=5, foreground="w"), |
22 | | - PathEffects.Normal()]) |
| 21 | + patheffects.Stroke(linewidth=5, foreground="w"), |
| 22 | + patheffects.Normal()]) |
23 | 23 |
|
24 | | -pe = [PathEffects.withStroke(linewidth=3, |
| 24 | +pe = [patheffects.withStroke(linewidth=3, |
25 | 25 | foreground="w")] |
26 | 26 | ax1.grid(True, linestyle="-", path_effects=pe) |
27 | 27 |
|
|
31 | 31 | cntr = ax2.contour(arr, colors="k") |
32 | 32 |
|
33 | 33 | plt.setp(cntr.collections, path_effects=[ |
34 | | - PathEffects.withStroke(linewidth=3, foreground="w")]) |
| 34 | + patheffects.withStroke(linewidth=3, foreground="w")]) |
35 | 35 |
|
36 | 36 | clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True) |
37 | 37 | plt.setp(clbls, path_effects=[ |
38 | | - PathEffects.withStroke(linewidth=3, foreground="w")]) |
| 38 | + patheffects.withStroke(linewidth=3, foreground="w")]) |
39 | 39 |
|
40 | 40 | # shadow as a path effect |
41 | 41 | ax3 = plt.subplot(133) |
42 | 42 | p1, = ax3.plot([0, 1], [0, 1]) |
43 | 43 | leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc='upper left') |
44 | | -leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()]) |
| 44 | +leg.legendPatch.set_path_effects([patheffects.withSimplePatchShadow()]) |
45 | 45 |
|
46 | 46 | plt.show() |
0 commit comments