Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b8ede6

Browse files
authored
Merge pull request #16504 from jklymak/doc-fix-pcolor2
DOC: more pcolor fixes
2 parents 7c78457 + 26da35c commit 1b8ede6

8 files changed

+18
-225
lines changed

examples/specialty_plots/leftventricle_bulleye.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
7979
theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60)
8080
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
8181
z = np.ones((128, 2)) * data[i]
82-
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
82+
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
8383
if i + 1 in seg_bold:
8484
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
8585
ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth + 1)
@@ -93,7 +93,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
9393
theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60)
9494
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
9595
z = np.ones((128, 2)) * data[i + 6]
96-
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
96+
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
9797
if i + 7 in seg_bold:
9898
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
9999
ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth + 1)
@@ -107,7 +107,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
107107
theta0 = theta[i * 192:i * 192 + 192] + np.deg2rad(45)
108108
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
109109
z = np.ones((192, 2)) * data[i + 12]
110-
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
110+
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
111111
if i + 13 in seg_bold:
112112
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
113113
ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth + 1)
@@ -119,7 +119,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
119119
r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T
120120
theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1)
121121
z = np.ones((theta.size, 2)) * data[16]
122-
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
122+
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
123123
if 17 in seg_bold:
124124
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
125125

examples/subplots_axes_and_figures/axes_margins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def f(t):
6262
ax2.use_sticky_edges = False
6363

6464
for ax, status in zip((ax1, ax2), ('Is', 'Is Not')):
65-
cells = ax.pcolor(x, y, x+y, cmap='inferno') # sticky
65+
cells = ax.pcolor(x, y, x+y, cmap='inferno', shading='auto') # sticky
6666
ax.add_patch(
6767
plt.Polygon(poly_coords, color='forestgreen', alpha=0.5)
6868
) # not sticky

examples/userdemo/colormap_normalizations_bounds.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/userdemo/colormap_normalizations_custom.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

examples/userdemo/colormap_normalizations_diverging.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/userdemo/colormap_normalizations_lognorm.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

examples/userdemo/colormap_normalizations_power.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

tutorials/colors/colormapnorms.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@
6262

6363
pcm = ax[0].pcolor(X, Y, Z,
6464
norm=colors.LogNorm(vmin=Z.min(), vmax=Z.max()),
65-
cmap='PuBu_r')
65+
cmap='PuBu_r', shading='auto')
6666
fig.colorbar(pcm, ax=ax[0], extend='max')
6767

68-
pcm = ax[1].pcolor(X, Y, Z, cmap='PuBu_r')
68+
pcm = ax[1].pcolor(X, Y, Z, cmap='PuBu_r', shading='auto')
6969
fig.colorbar(pcm, ax=ax[1], extend='max')
7070
plt.show()
7171

@@ -99,10 +99,10 @@
9999
pcm = ax[0].pcolormesh(X, Y, Z,
100100
norm=colors.SymLogNorm(linthresh=0.03, linscale=0.03,
101101
vmin=-1.0, vmax=1.0, base=10),
102-
cmap='RdBu_r')
102+
cmap='RdBu_r', shading='auto')
103103
fig.colorbar(pcm, ax=ax[0], extend='both')
104104

105-
pcm = ax[1].pcolormesh(X, Y, Z, cmap='RdBu_r', vmin=-np.max(Z))
105+
pcm = ax[1].pcolormesh(X, Y, Z, cmap='RdBu_r', vmin=-np.max(Z), shading='auto')
106106
fig.colorbar(pcm, ax=ax[1], extend='both')
107107
plt.show()
108108

@@ -131,10 +131,10 @@
131131
fig, ax = plt.subplots(2, 1)
132132

133133
pcm = ax[0].pcolormesh(X, Y, Z1, norm=colors.PowerNorm(gamma=0.5),
134-
cmap='PuBu_r')
134+
cmap='PuBu_r', shading='auto')
135135
fig.colorbar(pcm, ax=ax[0], extend='max')
136136

137-
pcm = ax[1].pcolormesh(X, Y, Z1, cmap='PuBu_r')
137+
pcm = ax[1].pcolormesh(X, Y, Z1, cmap='PuBu_r', shading='auto')
138138
fig.colorbar(pcm, ax=ax[1], extend='max')
139139
plt.show()
140140

@@ -171,18 +171,16 @@
171171
# even bounds gives a contour-like effect
172172
bounds = np.linspace(-1, 1, 10)
173173
norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256)
174-
pcm = ax[0].pcolormesh(X, Y, Z,
175-
norm=norm,
176-
cmap='RdBu_r')
174+
pcm = ax[0].pcolormesh(X, Y, Z, norm=norm, cmap='RdBu_r', shading='auto')
177175
fig.colorbar(pcm, ax=ax[0], extend='both', orientation='vertical')
178176

179177
# uneven bounds changes the colormapping:
180178
bounds = np.array([-0.25, -0.125, 0, 0.5, 1])
181179
norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256)
182-
pcm = ax[1].pcolormesh(X, Y, Z, norm=norm, cmap='RdBu_r')
180+
pcm = ax[1].pcolormesh(X, Y, Z, norm=norm, cmap='RdBu_r', shading='auto')
183181
fig.colorbar(pcm, ax=ax[1], extend='both', orientation='vertical')
184182

185-
pcm = ax[2].pcolormesh(X, Y, Z, cmap='RdBu_r', vmin=-np.max(Z))
183+
pcm = ax[2].pcolormesh(X, Y, Z, cmap='RdBu_r', vmin=-np.max(Z), shading='auto')
186184
fig.colorbar(pcm, ax=ax[2], extend='both', orientation='vertical')
187185
plt.show()
188186

@@ -217,8 +215,8 @@
217215
# dynamic range:
218216
divnorm = colors.TwoSlopeNorm(vmin=-500., vcenter=0, vmax=4000)
219217

220-
pcm = ax.pcolormesh(
221-
longitude, latitude, topo, rasterized=True, norm=divnorm, cmap=terrain_map)
218+
pcm = ax.pcolormesh(longitude, latitude, topo, rasterized=True, norm=divnorm,
219+
cmap=terrain_map, shading='auto')
222220
# Simple geographic plot, set aspect ratio beecause distance between lines of
223221
# longitude depends on latitude.
224222
ax.set_aspect(1 / np.cos(np.deg2rad(49)))
@@ -248,8 +246,8 @@ def __call__(self, value, clip=None):
248246
fig, ax = plt.subplots()
249247
midnorm = MidpointNormalize(vmin=-500., vcenter=0, vmax=4000)
250248

251-
pcm = ax.pcolormesh(
252-
longitude, latitude, topo, rasterized=True, norm=midnorm, cmap=terrain_map)
249+
pcm = ax.pcolormesh(longitude, latitude, topo, rasterized=True, norm=midnorm,
250+
cmap=terrain_map, shading='auto')
253251
ax.set_aspect(1 / np.cos(np.deg2rad(49)))
254252
fig.colorbar(pcm, shrink=0.6, extend='both')
255253
plt.show()

0 commit comments

Comments
 (0)