On Tuesday, April 5, 2011 6:17:34 AM UTC-4, MATLABdude wrote: > How can I make maybe 3D subfigures with Python and matplotlib? > > I found the following example (http://matplotlib.sourceforge.net/ > examples/mplot3d/subplot3d_demo.html), but it doesn't work. > > [snip] > > I am using Python 2.6.6., and matplotlib 0.99.3. > > How can I make several subfigures in 3D?
The demo works fine for me using Matplotlib 1.0.1. Here's a version that should work on your older version of Matplotlib. Instead of adding a subplot with projection='3d', it adds a normal subplot and gets the bounding rectangle. The rectangle is used to configure the Axes3D instance: from mpl_toolkits.mplot3d.axes3d import Axes3D import matplotlib.pyplot as plt # imports specific to the plots in this example import numpy as np from matplotlib import cm from mpl_toolkits.mplot3d.axes3d import get_test_data fig = plt.figure(figsize=(9.5,5.0)) #---- First subplot rect = fig.add_subplot(1, 2, 1).get_position() ax = Axes3D(fig, rect) 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) fig.colorbar(surf, shrink=0.5, aspect=10) #---- Second subplot rect = fig.add_subplot(1, 2, 2).get_position() ax = Axes3D(fig, rect) X, Y, Z = get_test_data(0.05) ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) plt.show() -- http://mail.python.org/mailman/listinfo/python-list