Martinho MA wrote:
> Hello,
> I have a contour with a clim smaller than the limits of my data... and 
> because of this there is an error when I try to add a colorbar.
> Can someone help?
> Thanks
> MMA

I think the basic problem is that you are trying to use a colorbar as a 
legend in a case where it doesn't really makes sense; the colorbar is 
mapping a range of values to a range of colors, and you have values that 
are outside that range.  There are a couple ways to fix the problem:

1) Try using "colorbar(extend='both')".  This is a workaround, but it 
may do what you want.

2) Explicitly specify a list of contour levels that are within the range 
of your clim.  This is a better solution.

Eric

> 
> eg:
> 
> x=arange(20)
> y=arange(30)
> x,y=meshgrid(x,y)
> v=sqrt(x+y)  # max=6.928, min=0.0
> 
> # next is ok
> figure()
> contour(x,y,v)
> clim(0,7)
> colorbar()
> 
> # next gives the error: "ValueError: levels are outside colorbar range"
> figure()
> contour(x,y,v)
> clim(2,6)
> colorbar()
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> 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


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to