Skip to content Skip to sidebar Skip to footer

Putting Limits To X,y,z Interpolated Heatmap In Matplotlib

I'm looking to plot a heatmap for which I have the value (=heatmap color) z at each couple of spatial x,y coordinates but I want to mark out the z values between [z0,z1] with z0=0.

Solution 1:

You can set the values in a numpy array to None to leave them unplotted. For example,

zmin = 0.0
zmax = 0.4
zi[(zi<zmin) | (zi>zmax)] = None
CS = plt.contourf(xi, yi, zi, 15, cmap=plt.cm.rainbow,
                  vmax=zmax, vmin=zmin)

enter image description here

Post a Comment for "Putting Limits To X,y,z Interpolated Heatmap In Matplotlib"