Closed
Description
Consider this code:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')
x, y = np.meshgrid(np.linspace(-1, 1), np.linspace(-1, 1))
z = x**2 + y**2
z[10:20, 10:20] = 0.0
masked_array = np.ma.masked_equal(z, 0.0)
palette = cm.gray
palette.set_over('g', 1.0)
palette.set_under('b', 1.0)
palette.set_bad('r', 1.0)
ax.plot_surface(x,y,masked_array,
rstride=1,
cstride=1,
cmap=palette,
vmin=-1,
vmax=1,
)
plt.show()
The area set to zero should be red, but it isn't. It works on a 2d axis using pcolormesh.