I have some three dimensional dataset where each data point is of form (x,y,z)
. I want to make a 3D plot where z
is expressed as a function of both x
and y
, in the form of a 3D surface. For that, I am using the following code:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,1,1,projection='3d')
ax.plot_surface(X,Y,Z,rstride=1,cstride=1,cmap='viridis',edgecolor='none')
plt.show()
Now, I have a baseline point (x0,y0,z0)
, and I want to have the surface's colormap to be defined as a function of z0
. More specifically, I want a different colormap for z<z0
and z>z0
, for example an intensifying red colormap for z<z0
and a green one for z>z0
.
How can I achieve that using matplotlib
?