|
56 | 56 | # A new figure, with individually ordered items |
57 | 57 |
|
58 | 58 | x = np.linspace(0, 2*np.pi, 100) |
| 59 | +plt.rcParams['lines.linewidth'] = 10 |
59 | 60 | plt.figure() |
60 | | -plt.plot(x, np.sin(x), linewidth=10, label='zorder=10', |
61 | | - zorder=10) # on top |
62 | | -plt.plot(x, np.cos(1.3*x), linewidth=10, label='zorder=1', |
63 | | - zorder=1) # bottom |
64 | | -plt.plot(x, np.sin(2.1*x), linewidth=10, label='zorder=3', |
65 | | - zorder=3) |
66 | | -plt.axhline(0, linewidth=10, label='zorder=2', |
67 | | - zorder=2) |
| 61 | +plt.plot(x, np.sin(x), label='zorder=10', zorder=10) # on top |
| 62 | +plt.plot(x, np.sin(1.1*x), label='zorder=1', zorder=1) # bottom |
| 63 | +plt.plot(x, np.sin(1.2*x), label='zorder=3', zorder=3) |
| 64 | +plt.axhline(0, label='zorder=2', color='grey', zorder=2) |
68 | 65 | plt.title('Custom order of elements') |
69 | | -l = plt.legend() |
| 66 | +l = plt.legend(loc='upper right') |
70 | 67 | l.set_zorder(20) # put the legend on top |
71 | 68 | plt.show() |
0 commit comments