I'm trying to display several rectangles (from matplotlib.patches) in 3D. I thought it would be possible to use the add_collection3d method similar to the demo on the examples page:http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html However, when I call this method on a PatchCollection, I get an error at line 295 in art3d.py.It expects the collection to have offsets, but offsets is None (by default) when I create the collection. /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mpl_toolkits/mplot3d/art3d.pyc in set_3d_properties(self, zs, zdir) 293 294 def set_3d_properties(self, zs, zdir):--> 295 xs, ys = zip(*self.get_offsets()) 296 self._offsets3d = juggle_axes(xs, ys, zs, zdir) 297 self._facecolor3d = self.get_facecolor() ValueError: need more than 0 values to unpack I am relatively new to Matplotlib, so I don't know if this is a bug or it is just my own misunderstanding.
Here's a simple example where I try it on a single rectangle and it fails with the above error message. # ----start example from mpl_toolkits.mplot3d import Axes3Dfrom matplotlib.collections import PolyCollection,PatchCollectionfrom matplotlib.colors import colorConverterimport matplotlib.pyplot as pltfrom matplotlib.patches import Rectangleimport numpy as np fig = plt.figure()ax = fig.gca(projection='3d') rec = Rectangle((5,2),2,2)recs = [rec]col = PatchCollection(recs)ax.add_collection3d(col, zs=[0.6], zdir='z') # ----end example Graham
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users