Skip to content

Commit

Permalink
Merge pull request #288 from BiAPoL/full-data-only-on-update
Browse files Browse the repository at this point in the history
Update full data only when data is changed
  • Loading branch information
Cryaaa authored Dec 19, 2023
2 parents cf705e9 + 0127935 commit ef30e52
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions napari_clusters_plotter/_Qt_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def __init__(self, parent=None, width=7, height=4, manual_clustering_method=None
self.last_xy_labels = None
self.last_datax = None
self.last_datay = None
self.full_data = None

super().__init__(self.fig)
self.mpl_connect("draw_event", self.on_draw)
Expand Down Expand Up @@ -602,6 +603,9 @@ def make_2d_histogram(
h, xedges, yedges = np.histogram2d(data_x, data_y, bins=bin_number)
self.last_datax = data_x
self.last_datay = data_y
self.full_data = pd.concat(
[pd.DataFrame(data_x), pd.DataFrame(data_y)], axis=1
)

self.axes.imshow(
h.T,
Expand All @@ -614,10 +618,8 @@ def make_2d_histogram(
self.axes.set_xlim(xedges[0], xedges[-1])
self.axes.set_ylim(yedges[0], yedges[-1])
self.histogram = (h, xedges, yedges)

full_data = pd.concat([pd.DataFrame(data_x), pd.DataFrame(data_y)], axis=1)
self.selector.disconnect()
self.selector = SelectFrom2DHistogram(self, self.axes, full_data)
self.selector = SelectFrom2DHistogram(self, self.axes, self.full_data)
self.axes.figure.canvas.draw_idle()

def make_1d_histogram(
Expand Down

0 comments on commit ef30e52

Please sign in to comment.