problem with x scale on error bar plot

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

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

    Fl?vio> I think a space before the first point and after the last
    Fl?vio> point of the plot should be added automatically, since no
    Fl?vio> 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')
    show()

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

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

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

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

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

to
        vmin = self.base.lt(dmin)
        vmax = self.base.gt(dmax)

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

JDH

*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.*

I got your point, for certain types fo plots such as error bars, histograms, bar plots, scatter plots, etc, there is only one way to go(viewlim > datalim). On these cases, the defaults could be overridden. for line plots, and similar ones viewlim could be set to equal datalim, what do you think?

I would be nice if other people spoke up on this subject…

Any other views on this?

_
    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')
show()
it seems like you want the viewlim to exceed the datalim. In cases
like
from matplotlib.matlab import *
t = linspace(0,1,100)
plot(t, sin(2*pi*t))
show()
it looks to me like having the xlim at 0,1 is the best solution.
To change the behavior, edit matplotlib/ticker.py and search for class
MultipleLocator. In the autoscale method, change
vmin = self.base.le(dmin)
vmax = self.base.ge(dmax)
to
vmin = self.base.lt(dmin)
vmax = self.base.gt(dmax)
and try both of the examples above in the le/ge case and in the lt/gt
case.
JDH
-------------------------------------------------------
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:_ [http://sf.net/ppc_contest.php](http://sf.net/ppc_contest.php)
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
[https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)

fiocruz4.jpg
Flávio Codeço Coelho, PhD

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil

···

On Wed, 2004-09-22 at 11:31, John Hunter wrote: