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


------------------------------------------------------------------------------
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

Reply via email to