Skip to content

Commit

Permalink
Merge pull request #784 from mantidproject/783_duplicate_bragg_peaks_…
Browse files Browse the repository at this point in the history
…on_overplott

Fix duplicate Bragg peaks on overplot
  • Loading branch information
robertapplin authored Jun 8, 2022
2 parents 90dddbf + bf02ccb commit b4c09af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mslice/cli/plotfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def errorbar(axes, workspace, *args, **kwargs):
if not cur_canvas.manager.has_plot_handler():
cur_canvas.manager.add_cut_plot(presenter, workspace.name)
cur_fig.canvas.draw()
cur_canvas.manager.update_axes(axes)
cur_canvas.manager.update_axes(axes, plot_over)

cut = Cut(cut_axis, int_axis, intensity_min, intensity_max, workspace.norm_to_one, width='',
algorithm=workspace.algorithm)
Expand Down
4 changes: 2 additions & 2 deletions mslice/plotting/plot_window/cut_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,14 @@ def _apply_offset(self, x, y):
path.vertices = np.add(self._waterfall_cache[line][index],
np.array([[ind * x, ind * y], [ind * x, ind * y]]))

def on_newplot(self, ax):
def on_newplot(self, ax, plot_over):
# This callback should be activated by a call to errorbar
new_line = False
line_containers = self._canvas.figure.gca().containers
num_lines = len(line_containers)
self.plot_window.action_waterfall.setEnabled(num_lines > 1)
self.plot_window.toggle_waterfall_edit()
if not self._is_icut:
if not self._is_icut and not plot_over:
self.plot_window.action_aluminium.setChecked(False)
self.plot_window.action_copper.setChecked(False)
self.plot_window.action_niobium.setChecked(False)
Expand Down
4 changes: 2 additions & 2 deletions mslice/plotting/plot_window/plot_figure_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ def update_grid(self):
if self._ygrid:
self.canvas.figure.gca().grid(True, axis='y')

def update_axes(self, ax):
def update_axes(self, ax, plot_over):
if self.plot_handler is not None:
self.plot_handler.on_newplot(ax)
self.plot_handler.on_newplot(ax, plot_over)

def move_window(self, x, y):
center = QtWidgets.QDesktopWidget().screenGeometry().center()
Expand Down

0 comments on commit b4c09af

Please sign in to comment.