mantid
mantid copied to clipboard
Unhandled exception when setting log axis on negative values
Describe the bug When attempting to set an axis to log on a colourfill where the axis values are negtive, there is an unhandled exception:
Traceback (most recent call last):
File "/opt/Mantid/lib/workbench/plotting/propertiesdialog.py", line 45, in on_ok
self.canvas.draw()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_qt5agg.py", line 127, in draw
super(FigureCanvasQTAggBase, self).draw()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1299, in draw
renderer, self, artists, self.suppressComposite)
File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2437, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "/opt/Mantid/lib/mantid/plots/resampling_image/samplingimage.py", line 72, in draw
self._resample_image()
File "/opt/Mantid/lib/mantid/plots/resampling_image/samplingimage.py", line 107, in _resample_image
xbins, ybins = self._calculate_bins_from_extent()
File "/opt/Mantid/lib/mantid/plots/resampling_image/samplingimage.py", line 98, in _calculate_bins_from_extent
xbins = int(np.ceil(bbox.width * dpi))
ValueError: cannot convert float NaN to integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/Mantid/lib/workbench/plotting/propertiesdialog.py", line 49, in on_ok
self.canvas.draw()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_qt5agg.py", line 127, in draw
super(FigureCanvasQTAggBase, self).draw()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1299, in draw
renderer, self, artists, self.suppressComposite)
File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2437, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "/opt/Mantid/lib/mantid/plots/resampling_image/samplingimage.py", line 72, in draw
self._resample_image()
File "/opt/Mantid/lib/mantid/plots/resampling_image/samplingimage.py", line 107, in _resample_image
xbins, ybins = self._calculate_bins_from_extent()
File "/opt/Mantid/lib/mantid/plots/resampling_image/samplingimage.py", line 98, in _calculate_bins_from_extent
xbins = int(np.ceil(bbox.width * dpi))
ValueError: cannot convert float NaN to integer
To Reproduce
- Load
SANSLOQCan2D.xsfrom the training course data, but setSpectrumMin = 1andSpectrumMax = 20 - Right click and select "Plot>Colorfill"
- Double click a value on the y-axis to open the "Edit axis" dialog.
- Select the "Log" checkbox and click OK.
Expected behavior Either disable the log button or display a message when attempting to apply the option.
Platform/Version (please complete the following information):
- OS: Ubunutu
- OS Version: 18.04
- Confirmed in 6.2 and 6.3
This issue has been automatically marked as stale because it has not had activity in 6 months. It will be closed in 7 days if no further activity occurs. Allowing issues to close as stale helps us filter out issues which can wait for future development time. All issues closed by stale bot act like normal issues; they can be searched for, commented on or reopened at any point. If you'd like a closed stale issue to be considered, feel free to either re-open the issue directly or contact a developer. To extend the lifetime of an issue please comment below, it helps us see that this is still affecting you and you want it fixed in the near-future. Extending the lifetime of an issue may cause the development team to prioritise it over other issues, which may be closed as stale instead.
This no longer causes an exception, maybe matplotlib handles it better now.