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

Skip to content

DOC: more pcolor fixes #16504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/specialty_plots/leftventricle_bulleye.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60)
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
z = np.ones((128, 2)) * data[i]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
if i + 1 in seg_bold:
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
ax.plot(theta0[0], [r[2], r[3]], '-k', lw=linewidth + 1)
Expand All @@ -93,7 +93,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
theta0 = theta[i * 128:i * 128 + 128] + np.deg2rad(60)
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
z = np.ones((128, 2)) * data[i + 6]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
if i + 7 in seg_bold:
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
ax.plot(theta0[0], [r[1], r[2]], '-k', lw=linewidth + 1)
Expand All @@ -107,7 +107,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
theta0 = theta[i * 192:i * 192 + 192] + np.deg2rad(45)
theta0 = np.repeat(theta0[:, np.newaxis], 2, axis=1)
z = np.ones((192, 2)) * data[i + 12]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
if i + 13 in seg_bold:
ax.plot(theta0, r0, '-k', lw=linewidth + 2)
ax.plot(theta0[0], [r[0], r[1]], '-k', lw=linewidth + 1)
Expand All @@ -119,7 +119,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None):
r0 = np.repeat(r0[:, np.newaxis], theta.size, axis=1).T
theta0 = np.repeat(theta[:, np.newaxis], 2, axis=1)
z = np.ones((theta.size, 2)) * data[16]
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm)
ax.pcolormesh(theta0, r0, z, cmap=cmap, norm=norm, shading='auto')
if 17 in seg_bold:
ax.plot(theta0, r0, '-k', lw=linewidth + 2)

Expand Down
2 changes: 1 addition & 1 deletion examples/subplots_axes_and_figures/axes_margins.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def f(t):
ax2.use_sticky_edges = False

for ax, status in zip((ax1, ax2), ('Is', 'Is Not')):
cells = ax.pcolor(x, y, x+y, cmap='inferno') # sticky
cells = ax.pcolor(x, y, x+y, cmap='inferno', shading='auto') # sticky
ax.add_patch(
plt.Polygon(poly_coords, color='forestgreen', alpha=0.5)
) # not sticky
Expand Down
44 changes: 0 additions & 44 deletions examples/userdemo/colormap_normalizations_bounds.py

This file was deleted.

50 changes: 0 additions & 50 deletions examples/userdemo/colormap_normalizations_custom.py

This file was deleted.

44 changes: 0 additions & 44 deletions examples/userdemo/colormap_normalizations_diverging.py

This file was deleted.

35 changes: 0 additions & 35 deletions examples/userdemo/colormap_normalizations_lognorm.py

This file was deleted.

32 changes: 0 additions & 32 deletions examples/userdemo/colormap_normalizations_power.py

This file was deleted.

28 changes: 13 additions & 15 deletions tutorials/colors/colormapnorms.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@

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

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

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

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

Expand Down Expand Up @@ -131,10 +131,10 @@
fig, ax = plt.subplots(2, 1)

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

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

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

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

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

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

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

pcm = ax.pcolormesh(
longitude, latitude, topo, rasterized=True, norm=midnorm, cmap=terrain_map)
pcm = ax.pcolormesh(longitude, latitude, topo, rasterized=True, norm=midnorm,
cmap=terrain_map, shading='auto')
ax.set_aspect(1 / np.cos(np.deg2rad(49)))
fig.colorbar(pcm, shrink=0.6, extend='both')
plt.show()