Revision: 6182 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6182&view=rev Author: jdh2358 Date: 2008-10-13 19:16:58 +0000 (Mon, 13 Oct 2008)
Log Message: ----------- more fixes to mlab/excel formatters Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/mpl_toolkits/exceltools.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-13 18:10:39 UTC (rev 6181) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-10-13 19:16:58 UTC (rev 6182) @@ -2181,7 +2181,7 @@ def tostr(self, x): if x is None: return 'None' - return (self.fmt%self.toval(x)).rstrip('.') + return self.fmt%self.toval(x) Modified: trunk/matplotlib/lib/mpl_toolkits/exceltools.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-10-13 18:10:39 UTC (rev 6181) +++ trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-10-13 19:16:58 UTC (rev 6182) @@ -41,8 +41,11 @@ xlstyle.num_format_str = '0.%s%%;[RED]-0.%s%%'%(zeros, zeros) format.scale = 1. elif isinstance(format, mlab.FormatFloat): - zeros = ''.join(['0']*format.precision) - xlstyle.num_format_str = '#,##0.%s;[RED]-#,##0.%s'%(zeros, zeros) + if format.precision>0: + zeros = ''.join(['0']*format.precision) + xlstyle.num_format_str = '#,##0.%s;[RED]-#,##0.%s'%(zeros, zeros) + else: + xlstyle.num_format_str = '#,##;[RED]-#,##' elif isinstance(format, mlab.FormatInt): xlstyle.num_format_str = '#,##;[RED]-#,##' else: @@ -99,11 +102,11 @@ ind = np.arange(len(r.dtype.names)) for row in r: - #print 'row', + for i in ind: val = row[i] format = formats[i] - + val = format.toval(val) if mlab.safe_isnan(val): ws.write(rownum, colnum+i, nanstr) elif mlab.safe_isinf(val): @@ -112,11 +115,8 @@ else: s = '-%s'%infstr ws.write(rownum, colnum+i, s) elif format.xlstyle is None: - val = format.toval(val) ws.write(rownum, colnum+i, val) else: - val = format.toval(val) - #print (i, r.dtype.names[i], val, format.toval(val)), ws.write(rownum, colnum+i, val, format.xlstyle) rownum += 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- 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-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins