On 03/31/2012 07:26 AM, Marston wrote:
> Hi, I'm trying to create a plot, with subplots where each row of x plots
> have a common colorbar beneath it. Only the the top row will have
> titles. I've tried creating a function to do this but I only achieve
> partial success. Here is an image created in another program that I want
> to duplicate: I made several functions to do this. Here's one of them:
> def Plot(self,title,plist): for k in np.sort(self.vdic.keys()):
> plt.subplot(5,13,self.window) cs =
> plt.contourf(22,22,np.squeeze(self.vdic[k]),plist['levels'],
> cmap=cm.get_cmap('jet',len(plist['levels'])-1)) plt.axis('off') if
> title: plt.title(k,fontsize=tsize) window += 1 cbar =
> plt.colorbar(cax=plist['cax'],orientation='h') I've given up in getting
> the text on the left because every attempt using text fails. Now if this
> is a horrible way and you have a better idea, please feel free to share.
> I'm new at matplotlib and this is a great way to see how things can be
> done better and in different ways.

The problem is that what you are trying to do is a bit too complicated 
for the basic pyplot interface and for subplots.  The axes_grid toolkit 
might be helpful, or you may want to calculate the axes positions 
yourself as in 
http://matplotlib.sourceforge.net/examples/pylab_examples/multi_image.html.

For your text on the left, you can add text to a figure using the same 
coordinates as you use for specifying axes positions: (0,0) is lower 
left, (1,1) is upper right. E.g., in "ipython --pylab",

fig = plt.figure()
ax = fig.add_axes([0.4, 0.45, 0.5, 0.1])
lableft = fig.text(0.1, 0.5, "A Label")
plt.draw() #needed only when interactive


Eric


> ------------------------------------------------------------------------
> View this message in context: Subplot array and colorbar
> <http://old.nabble.com/Subplot-array-and-colorbar-tp33544950p33544950.html>
> Sent from the matplotlib - users mailing list archive
> <http://old.nabble.com/matplotlib---users-f2906.html> at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to