On Thu, Jul 17, 2008 at 08:50:03AM +0200, Manuel Metz wrote: > 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% ...
The %g format produces "nice" numbers. For example: >>> print " ".join(["%g%%"%v for v in [1.0,2.5,5.000001,10.03]]) 1% 2.5% 5% 10.03% - Paul ------------------------------------------------------------------------- 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 Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel