Skip to content

Commit 522c296

Browse files
authored
skip existing arrays in ImageWidget.set_data() (#924)
1 parent de63805 commit 522c296

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fastplotlib/widgets/image_widget/_widget.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,11 @@ def set_data(
929929
for i, (new_array, current_array, subplot) in enumerate(
930930
zip(new_data, self._data, self.figure)
931931
):
932+
# if the new array is the same as the existing array, skip
933+
# this allows setting just a subset of the arrays in the ImageWidget
934+
if new_data is self._data[i]:
935+
continue
936+
932937
# check last two dims (x and y) to see if data shape is changing
933938
old_data_shape = self._data[i].shape[-self.n_img_dims[i] :]
934939
self._data[i] = new_array

0 commit comments

Comments
 (0)