Thanks Paul, On 24 March 2011 19:23, Paul Ivanov <pivanov...@gmail.com> wrote: > I think you can get the desired functionality with gridspec > alone. Take a look at > doc/users/plotting/examples/demo_gridspec06.py which you can find > here > > https://github.com/matplotlib/matplotlib/blob/f1c8/doc/users/plotting/examples/demo_gridspec06.py
I've played around with this example, and it seems like I'm not quite there yet. I should add that I'm using imshow rather than plot here. In this case, the inter-inner-grid spacing becomes dependent on the figure aspect ratio. I presume this is because it is trying to maintain (as it should) the aspect ratio of the images, but it would be nice for it do this my manipulating only the outside margins, and honour the wspace=0., hspace=0. as requested. Here's a simplified version of the above script to illustrate my point: import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np from itertools import product f = plt.figure(figsize=(9, 9)) # gridspec inside gridspec outer_grid = gridspec.GridSpec(2, 3, wspace=0.0, hspace=0.0) for i in xrange(6): inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0) for j, (c, d) in enumerate(product(range(1, 4), repeat=2)): ax = plt.Subplot(f, inner_grid[j]) ax.imshow(np.ones((10,10)) * c * d, vmin=1, vmax=9) ax.set_xticks([]) ax.set_yticks([]) f.add_subplot(ax) all_axes = f.get_axes() #show only the outside spines for ax in all_axes: for sp in ax.spines.values(): sp.set_visible(False) if ax.is_first_row(): ax.spines['top'].set_visible(True) if ax.is_last_row(): ax.spines['bottom'].set_visible(True) if ax.is_first_col(): ax.spines['left'].set_visible(True) if ax.is_last_col(): ax.spines['right'].set_visible(True) plt.show() Of course, it is relatively trivial to calculate the correct figure aspect ratio in this case, but after adding in other elements like labels, this can become problematic. Is it possible to specify exactly the inner spacing, and make the outer margins automatically adjusted to get everything to fit nicely? Thanks, Angus -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users