juseg / hyoga

Paleoglacier modelling framework
https://hyoga.io
GNU General Public License v3.0
8 stars 0 forks source link

Set aspect ratio equal for maps. #26

Closed juseg closed 1 year ago

juseg commented 1 year ago

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 commented 1 year ago

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