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

Set aspect ratio equal for maps. #26

Closed
juseg opened this issue Oct 17, 2022 · 1 comment · Fixed by #31
Closed

Set aspect ratio equal for maps. #26

juseg opened this issue Oct 17, 2022 · 1 comment · Fixed by #31
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@juseg
Copy link
Owner

juseg commented Oct 17, 2022

Currently aspect ratios are not set and they are disturbed with every new image plot. Adding a naturalearth() overlay hides this problem, because GeoPandas sets the aspect ratio to 'equal'. Xarray provides an aspect keyword, but this is not satisfactory because it also requires setting size and can't be used with the ax keyword. We probably need wrappers around imshow, contour etc. But at least in the case imshow, ax.set_aspect needs to come after the call to imshow, something like:

def _imshow(self, **kwargs):
    img = var.plot.imshow(**style)
    kwargs.get('ax', plt.gca()).set_aspect('equal')
    return img

I think the wrappers could also hide coordinate ticks and labels, and handle colorbars.

@juseg juseg added the enhancement New feature or request label Oct 17, 2022
@juseg juseg added this to the v0.2.1 milestone Oct 17, 2022
@juseg juseg self-assigned this Oct 17, 2022
@juseg juseg changed the title Set aspect ratio, default style for maps Set aspect ratio, default style for maps. Oct 17, 2022
@juseg juseg changed the title Set aspect ratio, default style for maps. Set aspect ratio, ~default style~ for maps. Nov 22, 2022
@juseg juseg changed the title Set aspect ratio, ~default style~ for maps. Set aspect ratio, ~~default style~~ for maps. Nov 22, 2022
@juseg juseg changed the title Set aspect ratio, ~~default style~~ for maps. Set aspect ratio equal for maps. Nov 22, 2022
@juseg
Copy link
Owner Author

juseg commented Nov 22, 2022

I opened a separate issue (#30) for ticks and labels. I am moving to a squash workflow thus trying to keep issues small.

@juseg juseg linked a pull request Nov 25, 2022 that will close this issue
@juseg juseg closed this as completed in #31 Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant