|
41 | 41 |
|
42 | 42 | plt.figure() |
43 | 43 | plt.subplot(211) |
44 | | -plt.plot(x, y, 'r', lw=3) |
| 44 | +plt.plot(x, y, 'C3', lw=3) |
45 | 45 | plt.scatter(x, y, s=120) |
46 | 46 | plt.title('Lines on top of dots') |
47 | 47 |
|
48 | 48 | # Scatter plot on top of lines |
49 | 49 | plt.subplot(212) |
50 | | -plt.plot(x, y, 'r', zorder=1, lw=3) |
| 50 | +plt.plot(x, y, 'C3', zorder=1, lw=3) |
51 | 51 | plt.scatter(x, y, s=120, zorder=2) |
52 | 52 | plt.title('Dots on top of lines') |
| 53 | +plt.tight_layout() |
53 | 54 |
|
54 | 55 | ############################################################################### |
55 | 56 | # A new figure, with individually ordered items |
56 | 57 |
|
57 | 58 | x = np.linspace(0, 2*np.pi, 100) |
58 | 59 | plt.figure() |
59 | | -plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', |
| 60 | +plt.plot(x, np.sin(x), linewidth=10, label='zorder=10', |
60 | 61 | zorder=10) # on top |
61 | | -plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', |
| 62 | +plt.plot(x, np.cos(1.3*x), linewidth=10, label='zorder=1', |
62 | 63 | zorder=1) # bottom |
63 | | -plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', |
| 64 | +plt.plot(x, np.sin(2.1*x), linewidth=10, label='zorder=3', |
64 | 65 | zorder=3) |
65 | | -plt.axhline(0, linewidth=10, color='blue', label='zorder=2', |
| 66 | +plt.axhline(0, linewidth=10, label='zorder=2', |
66 | 67 | zorder=2) |
67 | 68 | plt.title('Custom order of elements') |
68 | 69 | l = plt.legend() |
|
0 commit comments