error in simple plot command

Hello,

If I do the following:

plot([1],[1],'o')

it plots the one dot correctly.

if, however, one of those numbers is zero:

plot([1],[0],'o')

I get a floating point/divide by zero error:

/usr/lib/python2.4/site-packages/matplotlib/ticker.py in scale_range(vmin, vmax, n, threshold)
     731 dv = abs(vmax - vmin)
     732 meanv = 0.5*(vmax+vmin)
--> 733 var = dv/max(abs(vmin), abs(vmax))
     734 if var < 1e-12:
     735 return 1.0, 0.0

ZeroDivisionError: float division

Is there a fix for this?

In [11]:matplotlib.__version__
Out[11]:'0.87.2'

running linux, python 2.4.

      thanks,

        Brian Blais

···

--
-----------------

              bblais@...1129...
              http://web.bryant.edu/~bblais

Brian Blais wrote:

plot([1],[0],'o')

I get a floating point/divide by zero error:

/usr/lib/python2.4/site-packages/matplotlib/ticker.py in scale_range(vmin, vmax, n, threshold)
     731 dv = abs(vmax - vmin)
     732 meanv = 0.5*(vmax+vmin)
--> 733 var = dv/max(abs(vmin), abs(vmax))
     734 if var < 1e-12:
     735 return 1.0, 0.0

ZeroDivisionError: float division

Is there a fix for this?

You have to upgrade.

In [39]: plot([1],[0],'o')
Out[39]: [<matplotlib.lines.Line2D instance at 0xa38ac80c>]

In [40]: matplotlib.__version__
Out[40]: '0.87.7'

In [41]: matplotlib.__revision__
Out[41]: '$Revision: 2835 $'

···

--
cheers,
steve

Random number generation is the art of producing pure gibberish as quickly as possible.

You need to update your mpl to the current release or svn. This was fixed quite a few months ago, but I don't remember exactly when.

Eric

Brian Blais wrote:

···

Hello,

If I do the following:

plot([1],[1],'o')

it plots the one dot correctly.

if, however, one of those numbers is zero:

plot([1],[0],'o')

I get a floating point/divide by zero error:

/usr/lib/python2.4/site-packages/matplotlib/ticker.py in scale_range(vmin, vmax, n, threshold)
     731 dv = abs(vmax - vmin)
     732 meanv = 0.5*(vmax+vmin)
--> 733 var = dv/max(abs(vmin), abs(vmax))
     734 if var < 1e-12:
     735 return 1.0, 0.0

ZeroDivisionError: float division

Is there a fix for this?

In [11]:matplotlib.__version__
Out[11]:'0.87.2'

running linux, python 2.4.

      thanks,

        Brian Blais