From: Christophe B. <pro...@gm...> - 2014-03-12 11:17:59
|
I forgot to say that being under Mac O$, I can use with animate... So I do not know if i can build an infinite animation. Is it possible ? 2014-03-12 12:01 GMT+01:00 Christophe Bal <pro...@gm...>: > Yes I've read it. > > > 1. It proposes to update infos about the figure, this is what I do in > my update function which only change the color of one random rectangle > every time that a timer asks to do it. > 2. Then it is said to use plt.draw(), which is what I do. If I use a > timer, each draw takes merely 2 seconds for 64**2 fixed initial > squares instead of being very quick for 16**2 fixed initial squares. It is > certain that the draw is indeed a redraw. > > > > 2014-03-12 11:49 GMT+01:00 Derek <gam...@gm...>: > > Did you look at the link; the person updating the plots had the same issue >> - i.e. he did not know when the data would arrive or how long it would be >> active for. That sounds like your situation? >> >> >> On 12 March 2014 11:59, Christophe Bal <pro...@gm...> wrote: >> >>> I forgot to say that here the use of animations is not good because, I >>> have no max playing time. >>> >>> >>> 2014-03-12 10:56 GMT+01:00 Christophe Bal <pro...@gm...>: >>> >>> Hello. >>>> >>>> First of all, I forgot the link to my post : here it is<http://stackoverflow.com/questions/22320407/matplotlib-update-only-some-parts-of-a-figure> >>>> . >>>> >>>> Yes, for pedagogical reason, I would like to use matplotlib for >>>> beginner programmers, like me :-), such as to do some 80 old school games. >>>> >>>> The problem I met using the draw method is that it takes 2 seconds for >>>> a figure of 64**2 squares. This is due to the fact that everythin is >>>> redraw. Here is my update method. >>>> >>>> *------------------------------------------------* >>>> *def update():* >>>> * global colors, width, height* >>>> >>>> * x = randint(0, width - 1)* >>>> * y = randint(0, height - 1)* >>>> >>>> * plotgrid[y][x].set_facecolor(choice(colors))* >>>> >>>> * plt.draw()* >>>> >>>> >>>> >>>> 2014-03-12 10:44 GMT+01:00 Derek <gam...@gm...>: >>>> >>>> Its not really clear what you are trying to achieve (using Matplotlib >>>>> to play Tetris??); but this have some pointers: >>>>> >>>>> >>>>> http://stackoverflow.com/questions/10944621/dynamically-updating-plot-in-matplotlib >>>>> >>>>> >>>>> On 12 March 2014 11:33, Christophe Bal <pro...@gm...> wrote: >>>>> >>>>>> Hello. >>>>>> >>>>>> I've poste here a question but no one seems to have an hint to give >>>>>> so I repeat my question here. >>>>>> >>>>>> In the attached Python 3 code, I draw n**2 squares in black and then >>>>>> I dynamically change in a random way the colors of some squares. >>>>>> >>>>>> The problem I met is that at each new random choice, I redraw all the >>>>>> squares. I know that it is stupid for large number of squares. >>>>>> >>>>>> Is there a way to change some propriety of one square, and then to >>>>>> ask to matplotlib to redraw only what have changed ? I'm looking for >>>>>> something similar to `blint` for animations. >>>>>> >>>>>> Christophe BAL >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Learn Graph Databases - Download FREE O'Reilly Book >>>>>> "Graph Databases" is the definitive new guide to graph databases and >>>>>> their >>>>>> applications. Written by three acclaimed leaders in the field, >>>>>> this first edition is now available. Download your free book today! >>>>>> http://p.sf.net/sfu/13534_NeoTech >>>>>> _______________________________________________ >>>>>> Matplotlib-users mailing list >>>>>> Mat...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>>> >>>>>> >>>>> >>>> >>> >> > |