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

Hide Matplotlib Axes checkbox #2128

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

jsub1
Copy link
Contributor

@jsub1 jsub1 commented Apr 24, 2020

This creates a checkbox that allows the user to hide 2D matplotlib axis. Allows to hide/show axis to included when exporting as script. Also adds test for hiding the axis and exporting.

@jsub1
Copy link
Contributor Author

jsub1 commented Apr 24, 2020

For issue #1883

@codecov
Copy link

codecov bot commented Apr 24, 2020

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@7fcd828). Learn more about missing BASE report.

Files with missing lines Patch % Lines
glue/viewers/image/viewer.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2128   +/-   ##
=======================================
  Coverage        ?   87.96%           
=======================================
  Files           ?      246           
  Lines           ?    22726           
  Branches        ?        0           
=======================================
  Hits            ?    19991           
  Misses          ?     2735           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@astrofrog astrofrog self-requested a review April 29, 2020 15:11
Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! I finally had a chance to take this for a spin, and it works well! However, two requests before we can go ahead and merge:

  • When axes are not shown, we should also remove the white padding around the image. If you take a look at the init_mpl function you'll see it calls freeze_margins. I think when you turn off the axes you might want to change that to freeze the margins to zero, and then change the frozen margins back to what they are currently if axes are turned back on.

  • Currently if you load the L1448 cube, and show velocity on the x axis and say RA on the y axis, the MatplotlibImageMixin._set_wcs method is still getting called even when the axes are hidden. In principle we could avoid this call, or at least exit early inside that method if the axes are now shown - and then if the axes are turned on again, we could explicitly call _set_wcs. This might make the slider even smoother for cases where the coordinate labels take a while to compute.

  • Could you double check that in astropy.visualization.wcs, the ticks and so on are not being computed/drawn when the axes are hidden as is done here? I just want to make sure it's not that they are being computed but then not shown.

  • It looks like there are some real code style issues and potentially real test failures?

Thanks!

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Could you rebase and remove the last commit since that CI issue should now be fixed?

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.

2 participants