From: Matthew K. G. <mk...@cs...> - 2007-01-13 19:42:55
|
Hmm, I tried that but it didn't work. I also tried just using ax3d.hold(False), and also tried pylab.hold(False), but both times I still kept on getting multiple surfaces. -- Matt Eric Firing wrote: > 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 |