On Wed, Feb 23, 2011 at 4:19 PM, Rene Breton <superlumini...@gmail.com>wrote:
> Hi all, > > I'm making a 3d plot using Axes3D (plot_surface) and I want to get rid > of the 3d gray box that surrounds the object so that only the object > shows up. Is there a way to do it? After creating my Axes3D instance, I > can't find much else than methods to change the x,y,z labels and axis > limits. > > I found a hack using myAXINFO to change the color of each "panel" but > the axis line still remains there. > > Ideally, there would be methods to access the color, visibility, etc., > of these elements. Maybe it's somewhere I can't find them... > > > Here's a code snippet derived from one of the website's examples: > > ############# > from mpl_toolkits.mplot3d import Axes3D > from matplotlib import cm > from matplotlib.ticker import LinearLocator, FixedLocator, > FormatStrFormatter > import matplotlib.pyplot as plt > import numpy as np > > fig = plt.figure() > ax = fig.gca(projection='3d') > X = np.arange(-5, 5, 0.25) > Y = np.arange(-5, 5, 0.25) > X, Y = np.meshgrid(X, Y) > R = np.sqrt(X**2 + Y**2) > Z = np.sin(R) > surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet, > linewidth=0, antialiased=False) > ax.set_zlim3d(-1.01, 1.01) > > # The following makes the panels white, but the axis line remains there > myAXINFO = { 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2), 'color': > (1.0, 1.0, 1.0, 1.0, 1.0)}, 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, > 1, 2), 'color': (1.0, 1.0, 1.0, 1.0, 1.0)}, 'z': {'i': 2, 'tickdir': 0, > 'juggled': (0, 2, 1), 'color': (1.0, 1.0, 1.0, 1.0, 1.0)} } > ax.w_zaxis._AXINFO = myAXINFO > ax.w_yaxis._AXINFO = myAXINFO > ax.w_xaxis._AXINFO = myAXINFO > > plt.show() > ############# > > > Thanks! > > > Rene > > > Rene, Unfortunately, you have stumbled upon one of the ugliness of the mplot3d implementation. I am hoping to have more control available for the next release. But right now, there is no way to turn off the axes spines (because they aren't implemented as spines). If you really want to dig into the source code, you could change the color argument to the Line2D call in the init3d() method in matplotlib/lib/mpl_toolkits/axis3d.py I am sorry I can not be more helpful. Ben Root
------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users