Thanks for the comment, Jonathan. Yeah, I did not expect aspect='equal' to work but I tried it anyway ;-) Removing the extent argument indeed produces a very nice output but I have not tried yet to also get the tick labels right. Instead, I have now reverted back to matplotlib.pylab's subplots method and an extra axes for the colorbar (see code below just in case somebody else can use that). With some fiddling with spacing it looks ok now. It's just a mess to produce differently sized figures but I probably won't need to do that.
Best, Matthias <http://matplotlib.1069221.n5.nabble.com/file/n41080/2imshow%2B1colorbar.png> ########################################################### import numpy as np import numpy.random as npr from scipy.interpolate import griddata import matplotlib.pyplot as plt fig, axes = plt.subplots(nrows=1, ncols=2, figsize=[12,5]) for ax in axes: xmin, xmax = 0., 1. ymin, ymax = 0., 0.5 zmin, zmax = -1., 1. # create random data: N = 100 X = xmin + (xmax-xmin)*npr.random((N,)) # x_i in [0, 1] Y = ymin + (ymax-ymin)*npr.random((N,)) # y_i in [0, 0.5] Z = zmin + (zmax-zmin)*npr.random((N,)) # z_i in [-1, 1] # generate griddata for contour plot: numspaces = np.sqrt(N) xi = linspace(xmin, xmax, numspaces) yi = linspace(ymin, ymax, numspaces) zi = griddata((X, Y), Z, (xi[None,:], yi[:,None]), method='nearest') norm = matplotlib.colors.normalize(vmin=zmin, vmax=zmax) im = ax.imshow(zi, extent = [xmin,xmax,ymin,ymax], norm = norm, vmin = zmin, vmax = zmax, origin = 'lower', aspect = 2., interpolation = 'nearest') ax.grid(False) ax.set_xlabel('x') ax.set_ylabel('y') # add a colorbar: fig.subplots_adjust(left=0.05, bottom=0.2, right=0.8, top=0.95, wspace=0.2, hspace=0.2) cbar_ax = fig.add_axes([0.85, 0.2, 0.03, 0.75]) fig.colorbar(im, cax=cbar_ax) cbar_ax.set_ylabel('color level') fig.subplots_adjust(left=0.05, bottom=0.2, right=0.8, top=0.95, wspace=0.2, hspace=0.2) ############################################################## -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Squashed-axes-with-AxesGrid-tp40699p41080.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users