Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## matplotlib-users

 Re: [Matplotlib-users] axis scaling anomaly From: Gary Ruben - 2004-04-22 10:40:29 ```Just a little follow-up point. The normal axis autoscaling, with "plot(t, s, 'b-')" commented out, doesn't take account of the errorbar extrema. That is, the errorbars extend beyond the autoscaled window, whereas the window should be scaled to fully contain the errorbars. ----- Original Message ----- From: "Gary Ruben" Date: Thu, 22 Apr 2004 20:19:10 +1000 To: matplotlib-users@... Subject: [Matplotlib-users] axis scaling anomaly > Here's an example of my attempt to plot errorbar data with a series line of a different colour. This example reveals an anomaly with the axis scaling which may the sign of an underlying bug. If you comment out the "plot(t, s, 'b-')" line and run the example, the axes autoscale. If you run the example as is, the scaling changes for some reason. > Gary Ruben > : > > > from matplotlib.matlab import * > > t = arange(0.1, 4, 0.1) > s = exp(-t) > e = 0.1*randn(len(s)) > f = 0.1*randn(len(s)) > > grid(1) > lines = errorbar(t, s, e, f, '.', capsize=4) > set(lines, 'color', 'g') > plot(t, s, 'b-') > xlabel('Distance (m)') > ylabel('Height (m)') > title('Mean and standard error as a function of distance') > show() -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm ```
 Re: [Matplotlib-users] axis scaling anomaly From: John Hunter - 2004-04-26 14:55:34 ```>>>>> "Gary" == Gary Ruben writes: Gary> Just a little follow-up point. The normal axis autoscaling, Gary> with "plot(t, s, 'b-')" commented out, doesn't take account Gary> of the errorbar extrema. That is, the errorbars extend Gary> beyond the autoscaled window, whereas the window should be Gary> scaled to fully contain the errorbars. Hi Gary, it turns out there were two problems here, one trivial, one less so. The trivial problem was that we were not callling self.xaxis.autoscale_view() self.yaxis.autoscale_view() from Axes.errorbar. That's why you saw the effect of commenting and uncommenting the plot command. The deeper problem was that the errorbar caps are specified in points but the errorbars themselves are in data coords. All lines know how to transform themselves to display, but to properly autoscale the view lim we needed to know the cap dimensions in data coords. The fix was to modify axes.add_line to detect the case where the line data was not in data coords and then get the line extent in data coords by doing line coords -> display coords -> inverse data transform -> data coords. The short answer is it works now and will be included in the upcoming 0.53.1 bugfix release. JDH ```