formatter on colorbar ???

I just want to set ["10%","20%"....] on colorbar. However, failed again and
again. Thank you for your help.

The following code work properly. But when I set formatter =
FixedFormatter(["10%","20%","30%","40%"])
No labels is shown on colorbar, Why?
Is there any way to set the char "%" on colorbar?

from matplotlib.ticker import MultipleLocator,
FixedFormatter,FormatStrFormatter
from pylab import *
import matplotlib.colors as colors

delta = 0.025
x = y = arange(-3.0, 3.0, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10 * (Z2-Z1)

im = imshow(Z, interpolation='bilinear',
    norm = colors.Normalize(vmin = -1.0, vmax = 1.0, clip = False),
    origin='lower', extent=[-3,3,-3,3])

locator=MultipleLocator(0.4)
#formatter = FixedFormatter(["10%","20%","30%","40%"])
formatter=FormatStrFormatter("%0.1f")
colorbar(im, extend='both', shrink=0.8,format=formatter,ticks=locator)
show()

···


View this message in context: http://www.nabble.com/formatter-on-colorbar-----tp16656691p16656691.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Thanks for Eric Firing's reply to me.The solution is:

colorbar(im, extend='both', shrink=0.8,format='%0.1f%%',ticks=locator)
The double % in the format string makes it print a single %, and when
given a format string, the format kwarg automatically hands it off to a
FormatStrFormatter.

···


View this message in context: http://www.nabble.com/formatter-on-colorbar-----tp16656691p16790326.html
Sent from the matplotlib - users mailing list archive at Nabble.com.