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

EXP: Add colorbar to image maybe #403

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion glue_jupyter/bqplot/image/frb_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import math
import numpy as np

from bqplot import ColorScale
from bqplot import ColorScale, ColorAxis
from bqplot_image_gl import ImageGL

from ...utils import debounced
Expand Down Expand Up @@ -38,6 +38,9 @@ def __init__(self, viewer, array_maker):
self.viewer.figure.axes[1].scale.observe(self.debounced_update, 'min')
self.viewer.figure.axes[1].scale.observe(self.debounced_update, 'max')

# Colorbar?
self.viewer.figure.axes.append(ColorAxis(scale=self.scale_image))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mutating python list cannot be detected, only re-assignment, so to make bqplot see this change, you should use this:

Suggested change
self.viewer.figure.axes.append(ColorAxis(scale=self.scale_image))
self.viewer.figure.axes = [...self.viewer.figure.axes, ColorAxis(scale=self.scale_image)]


# NOTE: we deliberately don't call .update() here because when FRBImage
# is created for the main composite image layer the composite arrays
# haven't been set up yet, and for subset layers the layer gets force
Expand Down