|
31 | 31 |
|
32 | 32 | fig, ax = plt.subplots() |
33 | 33 | CS = ax.contour(X, Y, Z) |
34 | | -ax.clabel(CS, inline=1, fontsize=10) |
| 34 | +ax.clabel(CS, inline=True, fontsize=10) |
35 | 35 | ax.set_title('Simplest default with labels') |
36 | 36 |
|
37 | 37 | ############################################################################### |
|
43 | 43 | CS = ax.contour(X, Y, Z) |
44 | 44 | manual_locations = [ |
45 | 45 | (-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)] |
46 | | -ax.clabel(CS, inline=1, fontsize=10, manual=manual_locations) |
| 46 | +ax.clabel(CS, inline=True, fontsize=10, manual=manual_locations) |
47 | 47 | ax.set_title('labels at selected locations') |
48 | 48 |
|
49 | 49 | ############################################################################### |
50 | 50 | # You can force all the contours to be the same color. |
51 | 51 |
|
52 | 52 | fig, ax = plt.subplots() |
53 | 53 | CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed. |
54 | | -ax.clabel(CS, fontsize=9, inline=1) |
| 54 | +ax.clabel(CS, fontsize=9, inline=True) |
55 | 55 | ax.set_title('Single color - negative contours dashed') |
56 | 56 |
|
57 | 57 | ############################################################################### |
|
60 | 60 | matplotlib.rcParams['contour.negative_linestyle'] = 'solid' |
61 | 61 | fig, ax = plt.subplots() |
62 | 62 | CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed. |
63 | | -ax.clabel(CS, fontsize=9, inline=1) |
| 63 | +ax.clabel(CS, fontsize=9, inline=True) |
64 | 64 | ax.set_title('Single color - negative contours solid') |
65 | 65 |
|
66 | 66 | ############################################################################### |
|
71 | 71 | linewidths=np.arange(.5, 4, .5), |
72 | 72 | colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5'), |
73 | 73 | ) |
74 | | -ax.clabel(CS, fontsize=9, inline=1) |
| 74 | +ax.clabel(CS, fontsize=9, inline=True) |
75 | 75 | ax.set_title('Crazy lines') |
76 | 76 |
|
77 | 77 | ############################################################################### |
|
90 | 90 | plt.setp(zc, linewidth=4) |
91 | 91 |
|
92 | 92 | ax.clabel(CS, levels[1::2], # label every second level |
93 | | - inline=1, fmt='%1.1f', fontsize=14) |
| 93 | + inline=True, 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