Le Sunday 09 March 2008 14:32:05 Eric Firing, vous avez écrit :
> [EMAIL PROTECTED] wrote:
> >                             Hello,
> >
> > I have some stupid questions about how to use colorbar.
> >
> > 1) I would like to be able to put the colorbar where I went: top, bottom,
> > left, right. For what I see I can do only a vertical left and horizontal
> > bottom ones (with a simple use of the function).
> > I know that it's possible to do a colorbar only but it's difficult to
> > place them a little bit automatically and that bring my second question.
>
> This looks like a feature request: instead of specifying "horizontal" or
> "vertical", be able to specify "top", "bottom", "left", or "right".
> This is fairly easy in principle, but there are some wrinkles such that
> I am not sure it would be satisfactory in practice--some custom
> adjustments might usually be needed depending on whether the main axes
> have a title (in the case of "top") or an xlabel (in the case of
> "left").  You may be better off simply figuring out what main and
> colorbar axes positions work best for your particular case and then
> making those axes explicitly.

I agree it's more feature request. I'll look on how to implement your 
suggestion. 

> > 2) I would like that the colorbar with exactly the same size than the
> > image I plot with pcolor. It's working when I'm not using the
> > aspect='equal' in the subplot but not with this option. Naturally I want
> > to not change the aspect of my image and so it's a big problem for me.
> > The only solution I found is to manipulate the colorbar with the shrink
> > valu but it's a little bit painfull especially the value change for each
> > pcolor image (they doesn't have always the same size).
>
> This is a common request, and a reasonable one, but unfortunately it is
> not straightforward to implement automatically given mpl's internal
> structure.  Again, however, you get the desired result quite easily by
> creating your own axes explicitly.

This is what I was afraid... So I have a stupid question but how to do this, 
create the axes at the same place than the pcolor image?

I can see how I can recuperate the axes coordinates but I don't know how to 
use them:

im = pylab.pcolor(a)
ax = im.get_axes()
cs = pylab.colorbar()

but after I'm a little bit lost...

> > 3) I would like to give a label to the colorbar (ie if the colorbar is at
> > the bottom a label under the colorbar etc). To tell people what means the
> > colors but I didn't find anyway to do it. xlabel work for the pcolor
> > object (as expected) and there are no colorbar.xlabel function.
>
> Use the set_label() method.
> ...
> cbar = fig1.colorbar(im,orientation='horizontal')
> cbar.set_label('label')
> ...

Great thanks it's working perfectly.

> Eric

Thank you for your help,

N.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to