On 9/18/12 6:14 PM, Sean Lake wrote:
> Hello all,
>
> I want to adjust the wspace used in a gridspec plot on a cell by cell
> basis. Anyone have suggestions for how to do that? I haven't been
> able to find an api to do that directly. The other possibility would
> be to be able to embed a gridspec within a gridspec, but I'm not sure
> if that's possible, either.
>
> More details: I have a plot that has two subplots arranged in a
> single row or column. Both plots share their relevant border axis, so
> I don't want space between them. They also share a color bar,
> however, and the only way I've been able to get that to draw in a
> sane way was to give it it's own axes instance in a separate cell of
> the gridspec. I therefore want to remove the space between the main
> plots without removing it for the color bar. This worked fine for the
> wider than tall plots since I could stack them and set hspace to 0
> and have the color bar extend across rows. For the pair of plots that
> are more square, and therefor best put side by side, I'm having
> trouble finding a solution.
>

I wonder if hspace and wspace in gridspec should take arrays like 
width_ratios and height_ratios. Try axes_grid1 instead.
http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1
(though the documentation is not the best)

I think this example does what you want:

M

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np

clf()
ax = plt.subplot(111)
im = ax.imshow(np.arange(100).reshape((10,10)))

divider = make_axes_locatable(ax)
ax1 = divider.append_axes("right", size="100%", pad=0.0)

im1 = ax1.imshow(np.arange(100).reshape((10,10)).transpose())
cax = divider.append_axes("right", size="5%", pad=0.05)

plt.colorbar(im1, cax=cax)
plt.draw()

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to