This effect is happening within an web app that displays gridded
fields from multiple datasets (~4500 lines of code).  So I it's tricky
to create an example.  Although if I use numpy.min(grid) the minimum
is 0.  So, I think colorbar or matplotlib is interpreting the 0 as -0.
 (Matplotlib version 0.99.0 RC0)

The colorbar call that I'm using is:

cbar = pyplot.colorbar(plot,shrink=0.7, format="%1.1f",
spacing='proportional',orientation='vertical')

cbar.ax.set_ylabel(cbar_label(param,unit))

The function cbar_label is:

def cbar_label(param,unit):
    #Helper function for making colorbar label
    if param == "sig":
        if unit==1:
            cbar_label = "Feet"
        else:
            cbar_label = "Meters"
    elif param == "dir":
        cbar_label = "Radial Direction"
    elif param == "per":
        cbar_label = "Seconds"
    elif param[-5:] == "_wind":
        if unit == 3:
            cbar_label = "Kts"
        else:
            cbar_label = "M/S"
    elif param[-4:] == "_hgt":
        if unit == 5:
            cbar_label = "GPFt"
        else:
            cbar_label = "GPM"
    elif param == "slp":
        cbar_label = "Millibars"
    elif param == "1000_rh":
        cbar_label = "%"
    elif param == "1000_temp":
        if unit == 9:
            cbar_label = "Degrees F"
        else:
            cbar_label = "Degrees C"
    else:
        cbar_label = param
    return cbar_label

If this doesn't offer anything, I'll try to generate a
compartmentalized example of the issue.

Bruce
---------------------------------------
Bruce W. Ford
Clear Science, Inc.
br...@clearscienceinc.com
http://www.ClearScienceInc.com
http://www.facebook.com/clearscience
http://www.twitter.com/ROVs_rule
Phone: (904) 796-8101
Fax:  (904) 379-9704
8241 Parkridge Circle N.
Jacksonville, FL  32211
Skype:  bruce.w.ford

---------------------------------------
To schedule a meeting with Bruce, Go to: http://tungle.me/bruceford
----------------------------------------




On Fri, Aug 20, 2010 at 2:06 PM, Eric Firing <efir...@hawaii.edu> wrote:
> On 08/20/2010 05:29 AM, Bruce Ford wrote:
>> I have a grid with values ranging from exactly 0.0 and 100.0.  When I
>> plot this with colorbar, the base of the colorbar is labeled "-0.0".
>> Is this a default for 0.0...to plot it with as a negative number?  Any
>> workarounds?
>
> Would you provide a minimal runnable example, please, and specify what
> mpl version you are using?  It is certainly not intended or usual that 0
> be displayed as -0.
>
> Eric
>
>
>>
>> Bruce
>>
>> ---------------------------------------
>> Bruce W. Ford
>> Clear Science, Inc.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to