|
30 | 30 |
|
31 | 31 | fig, ax = plt.subplots()
|
32 | 32 | CS = ax.contour(X, Y, Z)
|
33 |
| -ax.clabel(CS, inline=True, fontsize=10) |
| 33 | +ax.clabel(CS, fontsize=10) |
34 | 34 | ax.set_title('Simplest default with labels')
|
35 | 35 |
|
36 | 36 | # %%
|
|
42 | 42 | CS = ax.contour(X, Y, Z)
|
43 | 43 | manual_locations = [
|
44 | 44 | (-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)]
|
45 |
| -ax.clabel(CS, inline=True, fontsize=10, manual=manual_locations) |
| 45 | +ax.clabel(CS, fontsize=10, manual=manual_locations) |
46 | 46 | ax.set_title('labels at selected locations')
|
47 | 47 |
|
48 | 48 | # %%
|
49 | 49 | # You can force all the contours to be the same color.
|
50 | 50 |
|
51 | 51 | fig, ax = plt.subplots()
|
52 | 52 | CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed.
|
53 |
| -ax.clabel(CS, fontsize=9, inline=True) |
| 53 | +ax.clabel(CS, fontsize=9) |
54 | 54 | ax.set_title('Single color - negative contours dashed')
|
55 | 55 |
|
56 | 56 | # %%
|
|
59 | 59 | plt.rcParams['contour.negative_linestyle'] = 'solid'
|
60 | 60 | fig, ax = plt.subplots()
|
61 | 61 | CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed.
|
62 |
| -ax.clabel(CS, fontsize=9, inline=True) |
| 62 | +ax.clabel(CS, fontsize=9) |
63 | 63 | ax.set_title('Single color - negative contours solid')
|
64 | 64 |
|
65 | 65 | # %%
|
|
70 | 70 | linewidths=np.arange(.5, 4, .5),
|
71 | 71 | colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5'),
|
72 | 72 | )
|
73 |
| -ax.clabel(CS, fontsize=9, inline=True) |
| 73 | +ax.clabel(CS, fontsize=9) |
74 | 74 | ax.set_title('Crazy lines')
|
75 | 75 |
|
76 | 76 | # %%
|
|
90 | 90 | CS.set_linewidth(lws)
|
91 | 91 |
|
92 | 92 | ax.clabel(CS, levels[1::2], # label every second level
|
93 |
| - inline=True, fmt='%1.1f', fontsize=14) |
| 93 | + fmt='%1.1f', fontsize=14) |
94 | 94 |
|
95 | 95 | # make a colorbar for the contour lines
|
96 | 96 | CB = fig.colorbar(CS, shrink=0.8)
|
|
0 commit comments