Open cailafinn opened 3 months ago
Stack trace I get when recreating this
Traceback (most recent call last):
File "C:\Users\bya67386\work\mantid\qt\applications\workbench\workbench\plotting\figuremanager.py", line 365, in launch_plot_options
self.plot_options_dialog = PlotConfigDialogPresenter(self.canvas.figure, parent=self.window)
File "C:\Users\bya67386\work\mantid\qt\python\mantidqt\mantidqt\widgets\plotconfigdialog\presenter.py", line 45, in __init__
curves_tab = CurvesTabWidgetPresenter(self.fig, parent_view=self.view, parent_presenter=self, legend_tab=legend_tab)
File "C:\Users\bya67386\work\mantid\qt\python\mantidqt\mantidqt\widgets\plotconfigdialog\curvestabwidget\presenter.py", line 39, in __init__
self.update_view()
File "C:\Users\bya67386\work\mantid\qt\python\mantidqt\mantidqt\widgets\plotconfigdialog\curvestabwidget\presenter.py", line 287, in update_view
self.set_errorbars_tab_enabled()
File "C:\Users\bya67386\work\mantid\qt\python\mantidqt\mantidqt\widgets\plotconfigdialog\curvestabwidget\presenter.py", line 247, in set_errorbars_tab_enabled
enable_errorbars = curve_has_errors(self.get_current_curve())
File "C:\Users\bya67386\work\mantid\qt\python\mantidqt\mantidqt\widgets\plotconfigdialog\curvestabwidget\__init__.py", line 114, in curve_has_errors
return ax.artists_workspace_has_errors(curve)
File "C:\Users\bya67386\work\mantid\Framework\PythonInterface\mantid\plots\mantidaxes.py", line 324, in artists_workspace_has_errors
workspace_index = workspace.getIndexFromSpectrumNumber(spec_num)
RuntimeError: Could not find spectrum number in any spectrum.
Describe the bug An unhandled exception occurs when a monitor workspace is cropped while the plot is open. For regular workspaces, cropping the workspace also updates the spectrum numbers associated with each curve, but for monitor workspaces they seem to keep spectrum 1 when it is removed. This causes an unhandled exception whenever the figure window is opened. To Reproduce
For example
Expected behavior The legend and lines should correctly represent the spectrum numbers present in the workspace, and allow the figure management widget to be opened.
Screenshots This screenshot shows the monitor workspace with it's missing first spectrum, but the legend shows a line with a spec num of 1.![image](https://github.com/mantidproject/mantid/assets/47181718/ef52a608-aba9-4d66-b4a0-32c1ba5695f1)
Platform/Version (please complete the following information):