On Wed, Feb 9, 2011 at 6:47 AM, neurino <neur...@gmail.com> wrote:

> Well, not that automatic...
>
> I wonder why matplotlib takes care of settings limits on data but fails in
> a common situation so I'm forced to override it every time because I don't
> know in advance what data I get...
>
> Thanks anyway.
>
> Cheers
> neurino
>
>
I did a little digging and I discovered a function I never noticed
before...  You can set a "margin" for an axis that can be used for
autoscaling purposes.

set_ymargin(self, m) method of matplotlib.axes.AxesSubplot instance
    Set padding of Y data limits prior to autoscaling.

    *m* times the data interval will be added to each
    end of that interval before it is used in autoscaling.

    accepts: float in range 0 to 1

So, in your code, if I set ymargin to 0.5, then the limits will
automatically be -0.5 to 1.5.

I think this is what you are looking for.

Ben Root
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to