matplotlib/matplotlib — pull request #1991 by mdboom (2013-05-10 13:11:49+00:00)
Title: bugfix for matplotlib/ticker.py (python 3.3)

(ref. current git version of mpl)

when I plot something with huge coordinate values, > 1E35, I get an error

File "matplotlib/ticker.py", line 550, in _set_format
if np.abs(locs - np.round(locs, decimals=sigfigs)).max() < thresh:
File "/usr/lib64/python3.3/site-packages/numpy/core/fromnumeric.py", line 2402, in round_
return round(decimals, out)
AttributeError: 'float' object has no attribute 'rint'

The problem is that the array becomes NoneType

ipdb> a
a = array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0], dtype=object)
decimals = 3
out = None

because the representation in

matplotlib/ticker.py overflows

10 ** self.orderOfMagnitude

what can be done as regular integer, hence

locs = (np.asarray(_locs) - self.offset) / 10 ** self.orderOfMagnitude

returns dtype=object

The solution is the following patch (just make "10" float --- "10."):

--- matplotlib/ticker.py~ 2013-05-10 16:43:44.000000000 +1000
+++ matplotlib/ticker.py 2013-05-10 17:44:35.385288785 +1000
@@ -536,7 +536,7 @@
_locs = list(self.locs) + [vmin, vmax]
else:
_locs = self.locs
- locs = (np.asarray(_locs) - self.offset) / 10 ** self.orderOfMagnitude
+ locs = (np.asarray(_locs) - self.offset) / 10. ** self.orderOfMagnitude
loc_range = np.ptp(locs)
if len(self.locs) < 2:
# We needed the end points only for the loc_range calculation.

I hope you can change that.

-Alexander