Skip to content

Commit 07d38b1

Browse files
authored
Merge pull request #430 from BiAPoL/call-replot-by-signal
Fix plot clearing
2 parents cb2269b + fcdba65 commit 07d38b1

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/napari_clusters_plotter/_new_plotter_widget.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self, napari_viewer):
6060
self.overlay_colormap_plot
6161
),
6262
}
63-
self._replot()
63+
self.plot_needs_update.emit()
6464

6565
def _napari_to_mpl_cmap(self, colormap_name):
6666
return LinearSegmentedColormap.from_list(
@@ -352,7 +352,7 @@ def _on_plot_type_changed(self):
352352
self.plotting_widget.active_artist.overlay_colormap = (
353353
cat10_mod_cmap
354354
)
355-
self._replot()
355+
self.plot_needs_update.emit()
356356

357357
def _on_overlay_colormap_changed(self):
358358
colormap_name = self.overlay_colormap_plot
@@ -363,21 +363,21 @@ def _on_overlay_colormap_changed(self):
363363
self.colormap_reference[(False, "SCATTER")] = self._napari_to_mpl_cmap(
364364
colormap_name
365365
)
366-
self._replot()
366+
self.plot_needs_update.emit()
367367

368368
def _on_histogram_colormap_changed(self):
369-
self._replot()
369+
self.plot_needs_update.emit()
370370

371371
def _checkbox_status_changed(self):
372-
self._replot()
372+
self.plot_needs_update.emit()
373373

374374
def _on_bin_auto_toggled(self, state: bool):
375375
"""
376376
Called when the automatic bin checkbox is toggled.
377377
Enables or disables the bin number box accordingly.
378378
"""
379379
self.control_widget.n_bins_box.setEnabled(not state)
380-
self._replot()
380+
self.plot_needs_update.emit()
381381

382382
# Connecting the widgets to actual object variables:
383383
# using getters and setters for flexibility
@@ -437,7 +437,7 @@ def x_axis(self):
437437
@x_axis.setter
438438
def x_axis(self, column: str):
439439
self.control_widget.x_axis_box.setCurrentText(column)
440-
self._replot()
440+
self.plot_needs_update.emit()
441441

442442
@property
443443
def y_axis(self):
@@ -446,7 +446,7 @@ def y_axis(self):
446446
@y_axis.setter
447447
def y_axis(self, column: str):
448448
self.control_widget.y_axis_box.setCurrentText(column)
449-
self._replot()
449+
self.plot_needs_update.emit()
450450

451451
@property
452452
def hue_axis(self):
@@ -744,3 +744,4 @@ def _reset(self):
744744
# )
745745
self._update_layer_colors(use_color_indices=False)
746746
self.control_widget.hue_box.setCurrentText("MANUAL_CLUSTER_ID")
747+
self.plot_needs_update.emit()

0 commit comments

Comments
 (0)