bugfix for matplotlib/ticker.py (python 3.3) #1991
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(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
I hope you can change that.
-Alexander