Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable scatter viewer density map image broadcast when not visible #467

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions glue_jupyter/bqplot/scatter/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def __init__(self, view, viewer_state, layer_state=None, layer=None):
vmin=self.density_auto_limits.min,
vmax=self.density_auto_limits.max,
histogram2d_func=self.compute_density_map,
visible=False
)

self.view.figure.marks = list(self.view.figure.marks) + [
Expand Down
5 changes: 4 additions & 1 deletion glue_jupyter/bqplot/scatter/scatter_density_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(
stretch=None,
dpi=None,
external_padding=None,
visible=True,
):

# FIXME: need to use weakref to avoid circular references
Expand All @@ -91,6 +92,7 @@ def __init__(
self.vmin = vmin
self.vmax = vmax
self.stretch = stretch
self.visible = visible

if dpi is not None:
self.dpi = dpi
Expand All @@ -106,6 +108,7 @@ def __init__(
self.observe(self._update_rendered_image, "vmin")
self.observe(self._update_rendered_image, "vmax")
self.observe(self._update_rendered_image, "stretch")
self.observe(self._update_rendered_image, "visible")

self._scale_image = ColorScale()
self._scales = {
Expand Down Expand Up @@ -194,7 +197,7 @@ def _update_counts(self, *args, **kwargs):

def _update_rendered_image(self, *args, **kwargs):

if self._counts is None:
if self._counts is None or not self.visible:
self.image = EMPTY_IMAGE
return

Expand Down