>>>>> "Andrea" == Andrea Gavana <[EMAIL PROTECTED]> writes:
Andrea> Hi Gang, Thank you guys, and thanks for the Wiki entry ;-) Andrea> Andrea. Andrea> I have a further small question. When I add a line to my Andrea> plot, the axes gracefully rescale to accomodate the new Andrea> data plotted. However, when I remove a line, they do not Andrea> rescale, even if I call: Andrea> locator = self.leftaxis.yaxis.get_major_locator() Andrea> locator.autoscale() Andrea> Or: Andrea> self.leftaxis.autoscale_view(scalex=False, scaley=True) Andrea> I also call self.canvas.draw(), self.Refresh()... nothing Andrea> happens. Is there a way to make the axes rescale after Andrea> removing a line from a plot? The Axes instance has two BBox (bounding box) instances -- the dataLim and the viewLim. The dataLim store a rectangle that bounds all the data in the Axes, and the viewLim are the x and y view limits, ie, xlim and ylim. Autoscaling sets the viewLim based on the dataLim. When you add lines to the plot, the dataLim are updated, but when you remove data with del ax.lines[-1] etc, the dataLim are not updated. If all you have in the Axes are line instances, you can update the dataLim with the remaining lines, but first you must tell it to ignore it's current limits. You do this with the ignore flag # after removing a line, do ignore = True for line in ax.lines: x = line.get_xdata() y = line.get_ydata() ax.dataLim.update_numerix(x, y, ignore) ignore = False If you have other data in your Axes, eg Polygons or Collections, it is a bit more complicated. It would be useful to have an Axes method like "auto_datalim" to for the datalim to readjust to all the current data. After you have tested this, would you mind updating the wiki with this information? Thanks, JDH ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users