problem with x scale on error bar plot

My comment would be that I agree with Flávio for the specific case of errorbar plots. That is, when you have errorbars, you want them slightly inset from the axes so that it's clear where they finish. I think this only applies to errorbar plots. So, if there's an easy way to have the scaling differentiate, I'd say the endpoints should NOT always exceed the data end points, but should for errorbar plots. I'm think changing the default behaviour would upset lots of people.
Another idea might be to just add a command like autoscale(factor) or autoscale(margin) or margin(inset) to specify on a per-case basis.



----- Original Message -----
From: John Hunter <jdhunter@...4...>
Date: Wed, 22 Sep 2004 06:31:58 -0500
To: Flávio Codeço Coelho <fccoelho@...35...>
Subject: Re: [Matplotlib-users] problem with x scale on error bar plot

    > Hi john, I am getting a bad autoscale when I generate a
    > two point y-error errorbar plot:

    > As you can see in the figure attached the points are
    > falling on the margin of the plot.

    > I think a space before the first point and after the last
    > point of the plot should be added automatically, since no
    > one will want a plot like this by default.

This is a fix that is trivial to implement. But I would like to get
some feedback because changing the default would affect every almost
all matplotlib plots.

The question is: should the autoscale endpoints always exceed the data
end points, or are there some cases in which it is desirable for the
datalim and viewlim to coincide? In this case

    from matplotlib.matlab import *
    plot([1,2], 'o')

it seems like you want the viewlim to exceed the datalim. In cases

    from matplotlib.matlab import *
    t = linspace(0,1,100)
    plot(t, sin(2*pi*t))

it looks to me like having the xlim at 0,1 is the best solution.

To change the behavior, edit matplotlib/ and search for class
MultipleLocator. In the autoscale method, change

        vmin = self.base.le(dmin)
        vmax =

        vmin =
        vmax =

and try both of the examples above in the le/ge case and in the lt/gt


This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here:
Matplotlib-users mailing list

Sign-up for Ads Free at