OverflowError: math range error

Hello all,
I am getting this error, and im not very experienced with matplotlib, but in
most files this code worked, but in some i just get this error:

Traceback (most recent call last):
  File "/home/paoli/public_html/netcdf2png.py", line 128, in <module>
    colorbar = fig.colorbar(pc)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 1022,
in colorbar
    cb = cbar.Colorbar(cax, mappable, **kw)
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 616,
in __init__
    ColorbarBase.__init__(self, ax, **kw)
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 214,
in __init__
    self.draw_all()
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 225,
in draw_all
    self._config_axes(X, Y)
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 252,
in _config_axes
    ticks, ticklabels, offset_string = self._ticker()
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 388,
in _ticker
    b = np.array(locator())
  File "/usr/lib/python2.5/site-packages/matplotlib/ticker.py", line 1006,
in __call__
    vmax = math.log(vmax)/math.log(b)
OverflowError: math range error
Traceback (most recent call last):
  File "/home/paoli/public_html/netcdf2png.py", line 128, in <module>
    colorbar = fig.colorbar(pc)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 1022,
in colorbar
    cb = cbar.Colorbar(cax, mappable, **kw)
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 616,
in __init__
    ColorbarBase.__init__(self, ax, **kw)
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 214,
in __init__
    self.draw_all()
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 225,
in draw_all
    self._config_axes(X, Y)
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 252,
in _config_axes
    ticks, ticklabels, offset_string = self._ticker()
  File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 388,
in _ticker
    b = np.array(locator())
  File "/usr/lib/python2.5/site-packages/matplotlib/ticker.py", line 1006,
in __call__
    vmax = math.log(vmax)/math.log(b)
OverflowError: math range error

Is there any workaround?
Thx in advance!

···

--
View this message in context: http://old.nabble.com/OverflowError%3A-math-range-error-tp31423048p31423048.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Do you have a minimal script that reproduces this error?

Cheers,
Mike

···

On 04/18/2011 07:37 AM, Muffles wrote:

Hello all,
I am getting this error, and im not very experienced with matplotlib, but in
most files this code worked, but in some i just get this error:

Traceback (most recent call last):
   File "/home/paoli/public_html/netcdf2png.py", line 128, in<module>
     colorbar = fig.colorbar(pc)
   File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 1022,
in colorbar
     cb = cbar.Colorbar(cax, mappable, **kw)
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 616,
in __init__
     ColorbarBase.__init__(self, ax, **kw)
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 214,
in __init__
     self.draw_all()
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 225,
in draw_all
     self._config_axes(X, Y)
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 252,
in _config_axes
     ticks, ticklabels, offset_string = self._ticker()
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 388,
in _ticker
     b = np.array(locator())
   File "/usr/lib/python2.5/site-packages/matplotlib/ticker.py", line 1006,
in __call__
     vmax = math.log(vmax)/math.log(b)
OverflowError: math range error
Traceback (most recent call last):
   File "/home/paoli/public_html/netcdf2png.py", line 128, in<module>
     colorbar = fig.colorbar(pc)
   File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 1022,
in colorbar
     cb = cbar.Colorbar(cax, mappable, **kw)
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 616,
in __init__
     ColorbarBase.__init__(self, ax, **kw)
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 214,
in __init__
     self.draw_all()
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 225,
in draw_all
     self._config_axes(X, Y)
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 252,
in _config_axes
     ticks, ticklabels, offset_string = self._ticker()
   File "/usr/lib/python2.5/site-packages/matplotlib/colorbar.py", line 388,
in _ticker
     b = np.array(locator())
   File "/usr/lib/python2.5/site-packages/matplotlib/ticker.py", line 1006,
in __call__
     vmax = math.log(vmax)/math.log(b)
OverflowError: math range error

Is there any workaround?
Thx in advance!