Thank you very much. That was very helpful.
The only thing now is that I have a set of quiver subplots (in a sparate figure) that I want to keep aligned to the contour subplots. After adding a horizontal colorbar at the bottom of the contour figure in a way similar to the example, I lose the alignment with the quiver plots. The easiest way I could think of to keep the alignment is to add transparent dummy axes identical in size to the ones I add to the contour figure. The only thing is that I don't know how to make everything in the axes transparent. I tried fiddling with set_alpha(), but I couldn't get it done. Any pointers?

Cheers,
Sharaf

On 28 January 2010 19:23, Eric Firing <efiring@hawaii.edu> wrote:
Sharaf Al-Sharif wrote:
Hi,
I'm trying to make a figure with a column of contourf() subplots using matplotlib.pyplot. The contour plots have the same levels and I only need one color bar. The problem is that I'm not sure how to place the color bar in the figure without messing up the alignment of the subplots. Can someone kindly tell me how this can be done? Thanks in advance.

See this example:
http://matplotlib.sourceforge.net/examples/pylab_examples/multi_image.html

and look at the colorbar docstring.

The example is probably more complicated than what you are talking about.  The basic point, though, is that you need to explicitly make the axes for the colorbar, and supply that via the "cax" kwarg, instead of letting colorbar make its own axes by stealing space from some other axes object. You can still use a set of subplots; you may need to use subplots_adjust to scoot them up or over, to leave room for your colorbar.

Eric


Sharaf


------------------------------------------------------------------------

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com


------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users