Potential divide by zero problem in ticker.py

Line 733 in ticker.py in matplotlib 0.87.2 has a potential divide by zero error:

var = dv/max(abs(vmin),abs(vmax))

I've triggered it with the following:

import pylab
import numpy as np
t = np.array([0.,1.,2.,3.],float)
a = np.array([0.,0.,0.,0.],float)
pylab.plot(t,a)

The error is:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\Lib\site-packages\matplotlib\pylab.py", line 2018, in plot
    ret = gca().plot(*args, **kwargs)
  File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2790, in plot
    self.autoscale_view()
  File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 817, in autoscal
e_view
    self.set_ylim(locator.autoscale())
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 798, in autosc
ale
    return take(self.bin_boundaries(dmin, dmax), [0,-1])
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 768, in bin_bo
undaries
    scale, offset = scale_range(vmin, vmax, nbins)
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 733, in scale_
range
    var = dv/max(abs(vmin), abs(vmax))
ZeroDivisionError: float division

This came up on the dev list, and I believe is fixed in svn now.

Thanks,

···

On 3/23/06, O'Keefe, Michael <Michael_OKeefe@...1058...> wrote:

Line 733 in ticker.py in matplotlib 0.87.2 has a potential divide by zero error:

var = dv/max(abs(vmin),abs(vmax))

I've triggered it with the following:

import pylab
import numpy as np
t = np.array([0.,1.,2.,3.],float)
a = np.array([0.,0.,0.,0.],float)
pylab.plot(t,a)

The error is:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\Lib\site-packages\matplotlib\pylab.py", line 2018, in plot
    ret = gca().plot(*args, **kwargs)
  File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2790, in plot
    self.autoscale_view()
  File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 817, in autoscal
e_view
    self.set_ylim(locator.autoscale())
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 798, in autosc
ale
    return take(self.bin_boundaries(dmin, dmax), [0,-1])
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 768, in bin_bo
undaries
    scale, offset = scale_range(vmin, vmax, nbins)
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 733, in scale_
range
    var = dv/max(abs(vmin), abs(vmax))
ZeroDivisionError: float division

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Michael,

Thanks, this is now fixed in svn.

Eric

O'Keefe, Michael wrote:

···

Line 733 in ticker.py in matplotlib 0.87.2 has a potential divide by zero error:

var = dv/max(abs(vmin),abs(vmax))

I've triggered it with the following:

import pylab
import numpy as np
t = np.array([0.,1.,2.,3.],float)
a = np.array([0.,0.,0.,0.],float)
pylab.plot(t,a)

The error is:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\Lib\site-packages\matplotlib\pylab.py", line 2018, in plot
    ret = gca().plot(*args, **kwargs)
  File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2790, in plot
    self.autoscale_view()
  File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 817, in autoscal
e_view
    self.set_ylim(locator.autoscale())
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 798, in autosc
ale
    return take(self.bin_boundaries(dmin, dmax), [0,-1])
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 768, in bin_bo
undaries
    scale, offset = scale_range(vmin, vmax, nbins)
  File "c:\python24\lib\site-packages\matplotlib\ticker.py", line 733, in scale_
range
    var = dv/max(abs(vmin), abs(vmax))
ZeroDivisionError: float division

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users