def _do_plot_spectrum(self, names, errors, overplot): """ Plot spectra from the selected workspaces :param names: A list of workspace names :param errors: If true then error bars will be plotted on the points :param overplot: If true then the add to the current figure if one exists and it is a compatible figure """ if overplot: compatible, error_msg = can_overplot() if not compatible: QMessageBox.warning(self, "", error_msg) return plot_from_names(names, errors, overplot)
def test_can_overplot_returns_false_for_active_patch_plot(self): plt.pcolormesh(np.arange(9.).reshape(3, 3)) allowed, msg = can_overplot() self.assertFalse(allowed) self.assertTrue(len(msg) > 0)
def test_can_overplot_returns_true_for_active_line_plot(self): plt.plot([1, 2]) self.assertTrue(can_overplot()[0])
def test_can_overplot_returns_false_with_no_active_plots(self): self.assertFalse(can_overplot()[0])
def test_can_overplot_returns_false_for_active_patch_plot(self): plt.pcolormesh(np.arange(9.).reshape(3,3)) allowed, msg = can_overplot() self.assertFalse(allowed) self.assertTrue(len(msg) > 0)