John Hunter wrote:
> On Wed, Jul 16, 2008 at 7:20 AM, David M. Kaplan <[EMAIL PROTECTED]> wrote:
>
> Thanks for the submission -- I await more informed commentary from
> those who actually use contouring....
>
Just because the discussion about clabel started, I want to post a short
snipplet of code that I found useful. It was some sort of hack to get a
nicer float formating for contours: contour lines represented confidence
levels of 1, 2.5, 5 and 10 per cent, and I wanted a labeling exactly as
I have written it here now. So, fmt='%.1f\%%' would have resulted in
1.0% 2.5% 5.0% ... but I wanted 1% 2.5% 5% ...
So this was my solution:
# some kind of hack: a nicer floating point formating
class nf(float):
def __repr__(self):
str = '%.1f' % (self.__float__(),)
if str[-1]=='0':
return '%.0f' % self.__float__()
else:
return '%.1f' % self.__float__()
levels = [nf(val) for val in [1.0, 2.5,5.0,10.0] ]
pylab.clabel(cs, inline=True, fmt='%r \%%')
As I said, it's sort of a hack but it works! It might not be worth to
add this to mpl, but probably as an example ...!?
Manuel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel