From: John H. <jdh...@ac...> - 2005-08-29 22:21:24
|
>>>>> "David" == David <dav...@fr...> writes: David> Hi all, and thanks for amazing matplotlib. I devellop my David> data processing / plotting software using glade, pygtk, David> scipy and matplotlib 0.83.2. David> I use the class library and I run into trouble with David> autoscaling. David> I expected that autoscale_view() function of axes class David> would do autoscaling. But if I update the data using David> set_data(), set_xdatat() or set_ydata() (of lines object) David> and I call autoscale_view() of the corresponding axes and David> then redraw the canvas, the scale is not changed and some David> data points are thus out of the picture. David> Do I miss or misunderstand something ? The axes keeps a copy of the "dataLim" and won't automatically know if you change the line's data. You need to call ax.update_datalim_numerix(x, y, ignore) where x and y are the numerix arrays you pass to line.set_data. If ignore is True, the previous data passed to the axes will be ignored in computing the new datalim. If False, the datalim will include the previous data and the current data you are passing it. After this, a call to ax.autoscale_view() should work as you expect. JDH |