diff --git a/qt/applications/workbench/workbench/plotting/figureerrorsmanager.py b/qt/applications/workbench/workbench/plotting/figureerrorsmanager.py index 81972ba0760e630a81b63973035d50c6d635ec9c..1460d38b405afe0a0f4ea47f58e2c4bd00fd91d4 100644 --- a/qt/applications/workbench/workbench/plotting/figureerrorsmanager.py +++ b/qt/applications/workbench/workbench/plotting/figureerrorsmanager.py @@ -110,9 +110,10 @@ class FigureErrorsManager(object): @classmethod def replot_curve(cls, ax, curve, plot_kwargs): if isinstance(ax, MantidAxes): - axis = ax.creation_args[0].get('axis', None) - if axis: - plot_kwargs['axis'] = axis + if ax.creation_args: + axis = ax.creation_args[0].get('axis', None) + if axis: + plot_kwargs['axis'] = axis try: new_curve = ax.replot_artist(curve, errorbars=True, **plot_kwargs) except ValueError: # ValueError raised if Artist not tracked by Axes diff --git a/qt/applications/workbench/workbench/plotting/test/test_figureerrorsmanager.py b/qt/applications/workbench/workbench/plotting/test/test_figureerrorsmanager.py index 84210d28220912fb104252c1c0a5b35e5e2836ab..8b47677f1ba364aacad2d5d733faa89b8f7b8f9b 100644 --- a/qt/applications/workbench/workbench/plotting/test/test_figureerrorsmanager.py +++ b/qt/applications/workbench/workbench/plotting/test/test_figureerrorsmanager.py @@ -138,6 +138,12 @@ class FigureErrorsManagerTest(unittest.TestCase): self.assertFalse(array_equal(self.ax.get_lines()[0].get_data(), self.ax.get_lines()[1].get_data())) + def test_creation_args_not_accessed_for_non_workspace_plots(self): + self.ax.plot([1, 2], [1, 2]) + + self.errors_manager.replot_curve(self.ax, self.ax.lines[0], {}) + self.assertEqual(0, len(self.ax.creation_args)) + if __name__ == '__main__': unittest.main()