Description
I write an application with a graphical user interface to load and plot data files (https://github.com/FilipDominec/plotcommander). When I simultaneously select the y-axis to be logarithmic and load a file containing zeros, the Ticker class from Matplotlib encounters an error and the plotting window stops working permanently, even if I try to open some "safe" file thereafter. In such a case of error, the whole window of my program has to be closed and launched again, which is obviously not acceptable for a user.
As a mere downstream programmer who only uses the library, I have no clue how to fix this issue myself. I tried to always reset the plotting by self.fig.clf()
, but it did not help. I believe that correct catching of the OverflowError would make Matplotlib more robust.
- Matplotlib version 1.5.1-1ubuntu1, Python version2.7.12, Platform Ubuntu 16.04 x64
- same experience under python 3
- I installed Matplotlib and Python from apt repository
Error message:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_gtk3cairo.py", line 45, in on_draw_event
self._render_figure(w, h)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_gtk3cairo.py", line 34, in _render_figure
self.figure.draw (self._renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1091, in draw
self.tight_layout(renderer, **self._tight_parameters)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1754, in tight_layout
rect=rect)
File "/usr/lib/python3/dist-packages/matplotlib/tight_layout.py", line 349, in get_tight_layout_figure
pad=pad, h_pad=h_pad, w_pad=w_pad)
File "/usr/lib/python3/dist-packages/matplotlib/tight_layout.py", line 126, in auto_adjust_subplotpars
tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots])
File "/usr/lib/python3/dist-packages/matplotlib/tight_layout.py", line 126, in <listcomp>
tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots])
File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 3683, in get_tightbbox
bb_yaxis = self.yaxis.get_tightbbox(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/axis.py", line 1073, in get_tightbbox
ticks_to_draw = self._update_ticks(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/axis.py", line 949, in _update_ticks
tick_tups = [t for t in self.iter_ticks()]
File "/usr/lib/python3/dist-packages/matplotlib/axis.py", line 949, in <listcomp>
tick_tups = [t for t in self.iter_ticks()]
File "/usr/lib/python3/dist-packages/matplotlib/axis.py", line 892, in iter_ticks
majorLocs = self.major.locator()
File "/usr/lib/python3/dist-packages/matplotlib/ticker.py", line 1538, in __call__
return self.tick_values(vmin, vmax)
File "/usr/lib/python3/dist-packages/matplotlib/ticker.py", line 1565, in tick_values
numdec = math.floor(vmax) - math.ceil(vmin)
OverflowError: cannot convert float infinity to integer