Matthew Koichi Grimes wrote: > I'd like to plot a 3D surface and its contours as the surface evolves. > When I do it by simply calling plot_surface and/or contour3D multiple > times, the plot doesn't clear the old surface before plotting the new > one, so I get a whole bunch of surfaces accumulating in the same plot: > > <snip> > import pylab as P > import matplotlib.axes3d as P3 > > # bad: plots multiple surfaces on top of each other > def animatePlot(): > > P.ion() > fig = P.gcf() > ax3d = P3.Axes3D(self.fig) > > for i in xrange(100): > x, y, z = getLatestData(i) > ax3d.plot_surface( x, y, z ) > ax3d.contour3D( x, y, z ) > P.draw()
Try putting "ax3d.hold(False)" before the plot_surface, and "ax3d.hold(True)" after it. I haven't tried it, but I think this should accomplish what you want. Eric ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users