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

Add a (skippable) check that the axes have equal aspect ratio. #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Apr 8, 2024

When the scalebar is not drawn on an aspect where imshow() has been called (e.g., a point cloud made with plot()), the axes aspect ratio is not automatically set to 1, in which case the scale bar will be wrong (or rather, it will only be correct in the direction (horizontal or vertical) in which it is drawn).

To avoid mistakes, add a check for the aspect ratio, emitting a warning when appropriate. The check can be skipped by using new variants for rotation: it can now be set to "horizontal-only" ("the scalebar only applies to the horizontal direction") or "vertical-only". (This could also have been a separate kwarg, but something like check_aspect=False reads a bit awkwardly to me -- let me know if you'd prefer that.)

When the scalebar is not drawn on an aspect where imshow() has been
called (e.g., a point cloud made with plot()), the axes aspect ratio is
not automatically set to 1, in which case the scale bar will be wrong
(or rather, it will only be correct in the direction (horizontal or
vertical) in which it is drawn).

To avoid mistakes, add a check for the aspect ratio, emitting a warning
when appropriate.  The check can be skipped by using new variants for
`rotation`: it can now be set to "horizontal-only" ("the scalebar only
applies to the horizontal direction") or "vertical-only".  (This could
also have been a separate kwarg, but something like `check_aspect=False`
reads a bit awkwardly to me.)
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