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

Implement support for showing world labels in profile viewer when in pixel space #346

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

astrofrog
Copy link
Member

@astrofrog astrofrog commented Feb 20, 2023

Note: this requires glue-viz/glue#2378

This is a feature that has been requested for jdaviz but is a generically useful feature - similar to what we do for images where we show images in pixel space and show the tick values/labels in world space, this PR implements something similar for the profile viewer in glue-jupyter (and we could in principle also extend this to the image viewer in glue-jupyter too).

Screenshot from 2023-02-20 11-53-51

Currently this needs bqplot/bqplot#1541 rebased on the bqplot v0.12.x branch.

This is very incomplete but already mostly works with a simple example (notebook included). The main things to still do are:

  • Support cases where the data has more than one dimension
  • Properly deal with display units (for now just works with original WCS units)
  • Add a callback property on the state to determine whether or not to show world coordinates when in pixel space
  • Add tests

And also (will need @maartenbreddels's help):

  • Investigate and fix issue with labels sometimes updating sometimes not (race condition in bqplot?). More details in a follow-up comment below
  • Determine how to do 'pretty' exponential notation
  • Setting tick_values and tick_labels to None does not seem to revert to default labelling

@astrofrog
Copy link
Member Author

astrofrog commented Feb 20, 2023

@maartenbreddels - a couple of questions for you:

  1. The labels sometimes update and sometimes don't - could you take a look at what might be happening? (just run the notebook here and pan/zoom x-axis to reproduce). Note that I am already using fix: axis formatting depended on initial values or changes bqplot/bqplot#1541 so there must be some further issues? See following animation:
Screencast.from.20-02-23.11.56.54.webm

See the final state of the video where some labels seem to be updated and some not.

  1. Is there a way to have 'pretty' exponential notation for labels? (kind of like 2 x 10^3 but with the superscript actually being a superscript. I noticed that I can set tick_labels to be values instead of strings which then lets the front-end format it, but I end up with values like 10000000000. Is there a way to tell bqplot to be smarter about labelling this? Or can I pass e.g. unicode or some other syntax to make things display nicely?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant