# bugfix for matplotlib/ticker.py (python 3.3) #1991

Merged
merged 1 commit into from May 10, 2013
+131 −134

None yet

### 2 participants

commented May 10, 2013
 (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
Member
commented May 10, 2013
 Duplicate of #1828.
 mdboom `Fix #1991 and #1828. Integer overlow on Python 3 causes a crash. Adds…` `… a test.` `9617af7`
Member
commented May 10, 2013
 @2sn: Thanks for finding the solution!
commented May 10, 2013
 Sorry about the duplicate. I did not find the original posting with Google. On 10/05/13 23:10, Michael Droettboom wrote: Duplicate of #1828. Reply to this email directly or view it on GitHub: #1991 (comment)
Member
commented May 10, 2013
 No worries about not finding it -- I'm just glad to have a solution. Merging.
merged commit `dadb035` into matplotlib:v1.2.x May 10, 2013

#### 1 check passed

default The Travis CI build passed
Details
This was referenced May 10, 2013
Closed

Closed

#### Axis tickmarks of 1e20 and higher fail #2652

deleted the mdboom:ticker-overflow branch Aug 7, 2014