|
From: Michael C. <mic...@gm...> - 2010-10-07 00:32:07
|
You are correct about the version. I was just working with the version installed on Fedora 13, and the recache works. Looks like a working solution for now. Thanks, Michael On Wed, Oct 6, 2010 at 8:18 PM, Jae-Joon Lee <lee...@gm...> wrote: > I believe that you're using older version of mpl (<1.0) and this is a > known issues, which has been fixed. > > > http://sourceforge.net/tracker/?func=detail&aid=2917758&group_id=80706&atid=560720 > > Try to add > > L1.recache() > > after set_ydata. > > Regards, > > -JJ > > > > On Thu, Oct 7, 2010 at 3:06 AM, Michael Cracraft > <mic...@gm...> wrote: > > I have a code that continuously modifies a numpy.ndarray variable. Then, > I > > use set_ydata on the matplotlib.lines.Line2D object to the same ndarray > > variable. Then, I call fig.canvas.draw() to redraw the figure, where fig > is > > Figure object. > > > > However, the line on the graph never changes. I print a few entries to > the > > console to make sure that the variable is changing. > > > > It seems like the only way I can get the line to update is to create a > > completely new ndarray, update that variable with the new values and use > > set_ydata on my line object. Then, the redraw works. Other things that > I > > tried that didn't seem to work were: > > > > L1.set_ydata(x[:]) > > L1.set_ydata(x.tolist()) > > L1.set_ydata(list(x)) > > > > > > where L1 is my line object, and x is my ndarray. To make it redraw I > have > > to do something like this. > > > > xnew = numpy.zeros(numpy.size(x,0)) > > for k in range(numpy.size(x,0)): > > xnew[k] = x[k] > > L1.set_ydata(xnew) > > fig.canvas.draw() > > > > Is there some switch I can set to force a redraw of the elements? I feel > > like I am missing something fundamental. > > > > Thanks, > > Michael > > > > -- > > _____________________________________________ > > > > > ------------------------------------------------------------------------------ > > Beautiful is writing same markup. Internet Explorer 9 supports > > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > > Spend less time writing and rewriting code and more time creating great > > experiences on the web. Be a part of the beta today. > > http://p.sf.net/sfu/beautyoftheweb > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- _____________________________________________ |