From: Thomas C. <tca...@gm...> - 2015-02-23 23:06:53
|
This should probably be changed to use the new and improved container class (along with error bar), but I should read the code to be sure. On Mon, Feb 23, 2015, 11:44 Benjamin Root <ben...@ou...> wrote: > Huh, how about that. ContourSet subclasses ScalarMappable, but not Artist. > I don't know if that is intentional or not, but given that most plotting > functions return artists, this would seem to be an anomaly. FuncAnimation > expects a list of Artists. Since QuadContourSet is (apparently) not an > Artist, then that is why it isn't working quite right. > > As for blitting, I doubt you are going to need it here. Blitting is really > only advantagous if the computation/draw time of the animated portion is > comparable to the computation/draw time of the unanimated portion. > Contouring tends to be time-consuming (relatively speaking), so I doubt you > will gain much benefit from blitting it. > > Ben Root > > On Mon, Feb 23, 2015 at 8:53 AM, Ignat Harczuk <ig...@gm...> wrote: > >> Firstly I would like to apologize in case this should belong in the >> matplotlib-users, I'm not sure if this is dev or users related. >> >> >> Let us say we want to animate a 2D contour plot, then passing the blit = >> True argument to FuncAnimation fails since the QuadContourSet has no axes >> attribute. >> >> Is it for some specific it is implemented like this? And maybe there a >> hack to get this to work? >> >> A working code example with the actually wanted one commented out. >> >> import numpy as np >> import matplotlib.animation as animation >> from matplotlib import pyplot as plt >> >> fig, ax = plt.subplots() >> >> x = np.linspace( -np.pi, np.pi, 50 ) >> y = np.linspace( -np.pi, np.pi, 50 ) >> X, Y = np.meshgrid( x, y ) >> Z = np.zeros( X.shape ) >> >> def init(): >> cont = ax.contourf( X, Y, Z ) >> cbar = plt.colorbar( cont ) >> return cont, >> >> def animate( t ): >> k = np.array( [1,1] ) >> omega = 0.5 >> >> x = np.linspace( -np.pi, np.pi, 50 ) >> y = np.linspace( -np.pi, np.pi, 50 ) >> X, Y = np.meshgrid( x, y ) >> Z = np.exp( 1j * (omega* t - X*k[0] ) ) * np.exp( - 1j * k[1]*Y ) >> cont = ax.contourf( X, Y, Z ) >> return cont, >> >> #ani = animation.FuncAnimation( fig, animate, frames = 100, interval = 1, >> repeat = False, blit = True, init_func = init,) >> ani = animation.FuncAnimation( fig, animate, frames = 100, interval = 1, >> repeat = False, init_func = init,) >> plt.show() >> >> >> >> ------------------------------------------------------------------------------ >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards >> with Interactivity, Sharing, Native Excel Exports, App Integration & more >> Get technology previously reserved for billion-dollar corporations, FREE >> >> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >> > ------------------------------------------------------------ > ------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=190641631& > iu=/4140/ostg.clktrk_______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > |