countour plot custom labels

in the help for the countour plot labeling it says:
fmt:
a format string for the label. Default is ‘%1.3f’
Alternatively, this can be a dictionary matching contour
levels with arbitrary strings to use for each contour level
(i.e., fmt[level]=string)
can somebody enlighten me how this works?
how do I connect levels to what dictionary keyword?

thank a lot,
Momme

This would only meaningful if you set contour levels manually.

plt.figure()
levels = [-1, 0, 1]
fmt = {-1.:"-1",
       0.:"0",
       1.:"+1"}
CS = plt.contour(X, Y, Z, levels)
plt.clabel(CS, inline=1, fontsize=10, fmt=fmt)

Regards,

-JJ

···

On Wed, Dec 2, 2009 at 6:32 AM, Momme Butenschön <mommebu@...2079...> wrote:

in the help for the countour plot labeling it says:
*fmt*:
a format string for the label. Default is '%1.3f'
Alternatively, this can be a dictionary matching contour
levels with arbitrary strings to use for each contour level
(i.e., fmt[level]=string)
can somebody enlighten me how this works?
how do I connect levels to what dictionary keyword?

thank a lot,
Momme

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users