matplotlib-scalebar icon indicating copy to clipboard operation
matplotlib-scalebar copied to clipboard

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

Open anntzer opened this issue 1 year ago • 0 comments

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.)

anntzer avatar Apr 08 '24 18:04 anntzer