Overlay of 3D surface with contours in Python / matplotlib -


i want numpy array plotted 3d surface , 0 contour line highlighted in striking color. use following code plot surface (k_mean array plotted):

fig = plt.figure() ax = fig.gca(projection='3d') x,y=np.meshgrid(range(k_mean.shape[0]), range(k_mean.shape[1]))  z=k_mean surf = ax.plot_surface(x, y, z, rstride=1, cstride=1,linewidth=0., edgecolor=none, alpha=0.8, cmap=cm.nipy_spectral, antialiased=false) cset = ax.contour(x, y, z, zdir='z', offset=0, cmap=cm.nipy_spectral) cset = ax.contour(x, y, z, zdir='x', offset=0, cmap=cm.nipy_spectral) cset = ax.contour(x, y, z, zdir='y', offset=120, cmap=cm.nipy_spectral) ax.set_xlim(0, 120) ax.set_ylim(0, 120) ax.set_zlim(0, 1) fig.colorbar(surf, shrink=0.5, aspect=5) plt.show() 

now have added following line works fine itself:
cs=plt.contour(x,y,z,levels=[0], colors='g', linewidths=3)

but depending on insert it, either surface plot or contour line plotted.

how can if fix in way 0 contour line appears on top of surface?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -