On Fri, Aug 13, 2010 at 3:34 AM, Jeremy Conlin <jlcon...@gmail.com> wrote:
> I have a problem with the scaling of the numbers on a colorbar.  The
> problem occurs when the numbers used as colorbar labels need to be
> scaled (i.e. by 1E3).  The colorbar correctly puts the scaling value
> on the top of the colorbar, but instead of of multiplying by a scale
> factor, addition is used instead.  See the attached script and figure
> for example.  In the example, it looks like the color scale goes from
> 0 to 2*5E3.  At least, that's what I thought when I first looked at
> it.  Instead it means 5000 to 5002.
>
> Is there anyway I can scale the colorbar labels by *multiplying* them
> by a scaling factor instead of *adding* a scaling factor?  That seems
> more intuitive to me and those I work with.
>

Given the value range of 5000-5002, I doubt how using the scaling
factor improve your plot.

To disable the use of offset (+5000),

cb = fig.colorbar(pc)

# do not use offset
cb.formatter.set_useOffset(False)

cb.update_ticks()

If you do want to use scaling factor,

# to use scaling factor
cb.formatter.set_scientific(True)
cb.formatter.set_powerlimits((0,0))

cb.update_ticks()

This will only work with matplotlib v1.0.
In older versions, try to replace "update_ticks" with
"update_bruteforce" (but I'm not sure if this will work)

IHTH,

-JJ

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