From: Benjamin Root <ben.root@ou...>  20120615 13:01:53

Ananduri, On Fri, Jun 15, 2012 at 8:47 AM, ananduri <arun.nanduri@...> wrote: > > Hello, > > I have some minor questions regarding matplotlib. I'm using it to make a 3d > plot, displaying a surface, it's contour map, a line climbing the surface > and its projection onto the contour map. > > http://old.nabble.com/file/p34015720/landscape_draft.pnglandscape_draft.png > > As you can see, when the lines cross the contourf, they are somewhat > obscured. Before I made the contourf transparent, the lines were blocked, > even though they were above the contour plot when I viewed the picture from > a different angle. Can this be fixed? I want the lines to appear on top of > the contour plot. > > Unfortunately, no. Matplotlib was originally designed as a 2D layering renderer. The mplot3d toolkit tries to work within that framework, but in the end, each artist object has to be represented by a single 3rd dimension coordinate (the layer), and so when two artists share bounding box regions, physically incorrect results will happen. Please see this FAQ: http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/faq.html#my3dplotdoesntlookrightatcertainviewingangles > Also, I am trying to extend the z axis to be lower. This is most of the > code > I'm using: > > fig=plt.figure(1) > ax=fig.gca(projection='3d') > > x=np.arange(0,2.5,.02) > y=np.arange(0,2.3,.02) > x,y=np.meshgrid(x,y) > > ax.plot_surface(x,y,Z(x,y),alpha=0.3) > > cset=ax.contourf(x,y,Z(x,y),zdir='z',offset=2, > cmap=plt.cm.jet,levels=np.linspace(0,9,100),alpha=0.5) > > ax.set_xlabel('x') > ax.set_ylabel('y') > > ax.set_zlim(2,8) #This is where I try to change the z axis limits. > > plt.show() > > I'm excluding the code which plots the lines. ax.set_zlim doesn't do > anything; why is this? > That would depend on which version of matplotlib you are using. The v1.1.x branch should have that working properly. Cheers! Ben Root 