I am trying to plot a 2D data set using xarray (which uses matplotlib.pcolormesh) while keeping the natural aspect ratio of the data.
Example:
import xarray as xr
import matplotlib.pyplot as plt
plt.close('all')
data = xr.DataArray(np.random.randn(2, 3), dims=('x', 'y'),coords={'x': [10, 20],'y' : [0,50,100]})
data.plot() # Will produce a square plot
The result is

Adding a plt.gca().set_aspect('equal') does scale the plot in the way I want, however, the height of the colorbar is unchanged yielding

Using the parameters size, aspect, or figsize does not help either.
For the above example:
data.plot(size=6, aspect=150 / 30. * 6)
(or with the same result data.plot(figsize=(150 / 30. * 6,6)))

which is better but still off (maybe due to the colorbar?).