From: <dav...@fr...> - 2005-08-30 20:01:13
|
Hello, No actually it doesn't work exactly as I expected. I have different lines (at least two) that I would like to update and also hide/show and I expected that autoscaling will take all these aspects (updated data, hiden data) to scale the graph to all visibl= e data. The main problem is that old data limit is kept or totaly lost. The axes scaling doesn't seem to work with the list of lines, but is updated each time you add a line to the axes (as far as I can undestand from the source code). So the scale can only be increased but never decreased. Am I write or wrong ? Furthermore I use the sharey stuff that complicated a bit the story. So I don't think I can easelly do what I want using the axes class. Maybe I should calculate the scaling in my software and set the min/max v= alue. If one of you have another idea please let me know. Thanks for your help, David Selon John Hunter <jdh...@ac...>: > >>>>> "David" =3D=3D David <dav...@fr...> writes: > 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. > > 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 > |