You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Axis tickmarks with values of 1e20 or higher break a rendering process.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/home/gereon/sideprojects/selectionforagainst/generate_graphs.py", line 138, in <module>
pl.savefig(os.path.join(folder, "xcor{:s}.png".format(run_id)))
File "/usr/local/lib/python3.3/site-packages/matplotlib/pyplot.py", line 472, in savefig
return fig.savefig(*args, **kwargs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/figure.py", line 1364, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/backend_bases.py", line 2093, in print_figure
**kwargs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/backends/backend_agg.py", line 491, in print_png
FigureCanvasAgg.draw(self)
File "/usr/local/lib/python3.3/site-packages/matplotlib/backends/backend_agg.py", line 439, in draw
self.figure.draw(self.renderer)
File "/usr/local/lib/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/figure.py", line 1000, in draw
func(*args)
File "/usr/local/lib/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/axes.py", line 2088, in draw
a.draw(renderer)
File "/usr/local/lib/python3.3/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/axis.py", line 1049, in draw
ticks_to_draw = self._update_ticks(renderer)
File "/usr/local/lib/python3.3/site-packages/matplotlib/axis.py", line 936, in _update_ticks
tick_tups = [t for t in self.iter_ticks()]
File "/usr/local/lib/python3.3/site-packages/matplotlib/axis.py", line 936, in <listcomp>
tick_tups = [t for t in self.iter_ticks()]
File "/usr/local/lib/python3.3/site-packages/matplotlib/axis.py", line 882, in iter_ticks
self.major.formatter.set_locs(majorLocs)
File "/usr/local/lib/python3.3/site-packages/matplotlib/ticker.py", line 483, in set_locs
self._set_format(vmin, vmax)
File "/usr/local/lib/python3.3/site-packages/matplotlib/ticker.py", line 550, in _set_format
if np.abs(locs - np.round(locs, decimals=sigfigs)).max() < thresh:
File "/usr/local/lib/python3.3/site-packages/numpy/core/fromnumeric.py", line 2402, in round_
return round(decimals, out)
AttributeError: 'float' object has no attribute 'rint'
Diagnosis
This happens due to line 539 in the definition of _set_format (in matplotlib/ticker.py):
For self.orderOfMagnitude>=20, 10**self.orderOfMagnitude cannot be cast into numpy.uint64, so the generated array is of dtypeobject, and this leads to the whole of locs acquiring that dtype. The resulting objects matplotlib tries to round in the later steps are therefore not numpy.float64s, but python floats, which do not have an rint method.
If I were more familiar with the intestines of matplotlib, this might just be a pull request, but from my current perspective I cannot decide how much just making the 10 a float, and thereby making the full thing become a numpy.array of numpy.float64s, might break other things.
The text was updated successfully, but these errors were encountered:
I would suggest making a PR with that change. It is the best way to get feed back on the change and the test suite (which you can/should run locally) will tell us if this breaks anything.
Symptoms
Axis tickmarks with values of 1e20 or higher break a rendering process.
Diagnosis
This happens due to line 539 in the definition of
_set_format
(in matplotlib/ticker.py):For
self.orderOfMagnitude>=20
,10**self.orderOfMagnitude
cannot be cast intonumpy.uint64
, so the generated array is ofdtype
object
, and this leads to the whole oflocs
acquiring thatdtype
. The resulting objects matplotlib tries to round in the later steps are therefore notnumpy.float64
s, but pythonfloat
s, which do not have anrint
method.Fix suggestion
If I were more familiar with the intestines of
matplotlib
, this might just be a pull request, but from my current perspective I cannot decide how much just making the10
a float, and thereby making the full thing become anumpy.array
ofnumpy.float64
s, might break other things.The text was updated successfully, but these errors were encountered: