glue-jupyter icon indicating copy to clipboard operation
glue-jupyter copied to clipboard

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

Open astrofrog opened this issue 2 years ago • 1 comments

Note: this requires https://github.com/glue-viz/glue/pull/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 https://github.com/bqplot/bqplot/pull/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:

  • [x] Support cases where the data has more than one dimension
  • [x] Properly deal with display units (for now just works with original WCS units)
  • [x] 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):

  • [x] 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
  • [x] Setting tick_values and tick_labels to None does not seem to revert to default labelling

astrofrog avatar Feb 20 '23 11:02 astrofrog

@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 https://github.com/bqplot/bqplot/pull/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?

astrofrog avatar Feb 20 '23 12:02 astrofrog