python - Custom colormap in matplotlib for 3D surface plot -
i have surface plot specified colormap. following how it:
import numpy np import matplotlib.pyplot plt import math mpl_toolkits.mplot3d import axes3d matplotlib import cm import plaque_vessel_models # model creation ptx= [] pty = [] ptz = [] ptx1 = [] pty1 = [] ptz1 = [] pt_f = [] ang = np.linspace(0,2*np.pi,360) x_list = [100,90,80,70,60,50,40,30,20,10,5] in range(0,10): x = [] y = [] z = [] pt = [] t in range(0,len(ang)): x.append(x_list[i]*math.cos(ang[t])) y.append(50*math.sin(ang[t])) z.append(i) pt.append([x,y,z]) pt_f.append(pt) ptx.append(x) pty.append(y) ptz.append(z) # surface plot fig = plt.figure() ax = axes3d(fig) c_l = plaque_vessel_models.curvature3d(np.array(ptx),np.array(pty),np.array(ptz),'m') ax.plot_surface(np.array(ptx),np.array(pty),np.array(ptz),facecolors = cm.jet(np.array(c_l)),rstride=1, cstride=5,antialiased=false) m = cm.scalarmappable(cmap = cm.jet) m.set_array(c_l) fig.colorbar(m,shrink = 0.5)
this result:
i want colorbar values range 0.5 - 1.0 instead of default 0-1. how should approach this?
m.set_clim(vmin=0.5, vmax=1.0)
Comments
Post a Comment