-
Notifications
You must be signed in to change notification settings - Fork 76
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
Hover spectrum with extra axis #2661
base: main
Are you sure you want to change the base?
Conversation
Codestyle Codestyle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some suggestions i came up with while working on this, and
bqplot/bqplot#1638
should fix the issue you mentioned.
self._extra_axis.send_state(["scale", "visible"]) | ||
self._spectrum_viewer.figure.send_state(["fig_margin", "axes"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't be needed, maybe axes because you mutate them.
#self._reset_spectrum_viewer_bounds() | ||
# Fully remove the extra axis rather than just setting to invisible | ||
if self._extra_axis in self._spectrum_viewer.figure.axes: | ||
self._spectrum_viewer.figure.axes.remove(self._extra_axis) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._spectrum_viewer.figure.axes.remove(self._extra_axis) | |
axes = self._spectrum_viewer.figure.axes.copy() | |
axes.remove(self._extra_axis) | |
self._spectrum_viewer.figure.axes = axes |
mutations are not detected
self._spectrum_viewer = self.viewer.jdaviz_helper.app.get_viewer('spectrum-viewer') | ||
# Add extra y-axis to show on right hand side of spectrum viewer | ||
if self._extra_axis not in self._spectrum_viewer.figure.axes: | ||
self._spectrum_viewer.figure.axes.append(self._extra_axis) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._spectrum_viewer.figure.axes.append(self._extra_axis) | |
self._spectrum_viewer.figure.axes = [*self._spectrum_viewer.figure.axes, self._extra_axis] |
mutations are not detected
self._mark.visible = True | ||
y_values = spectrum.flux[x, y, :] | ||
if np.all(np.isnan(y_values)): | ||
self._mark.visible = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While trying to reproduce the bug in bqplot I noticed this resulted in my axis not being visible most of the time, maybe the test in the line above is faulty?
This is a follow up to #2647 that would overlay the preview spectrum on whatever the current zoom is, with an additional y-axis on the right to show the flux of the preview spectrum. Currently blocked by a potential bqplot bug, where the axis tick values are not updating when the axis scale updates.