[BangPypers] [Matplotlab]: Generate only tabular report

Hussain Bohra hussainbohra_30 at yahoo.com
Mon Feb 22 15:48:33 CET 2010


Hi All,

Can any one tell me how to generate only table using MatPlotLab.

Please find my code:

# do this before importing pylab or pyplot
import matplotlib

matplotlib.use('Agg')
from pylab import figure, table

fig = figure()


colLabels = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
rowLabels = ['%d year' % x for x in (100, 50, 20, 10, 5)]
cellText = [['66.4', '174.3', '75.1', '577.9', '32.0'], ['124.6', '555.4', '153.2', '677.2', '192.5'], ['213.8', '636.0', '305.7', '1175.2', '796.0'], ['292.2', '717.8', '456.4', '1368.5', '865.6'], ['431.5', '1049.4', '799.6', '2149.8', '917.9']]

table(cellText=cellText,
                  colLabels=colLabels)

fig.savefig('test12.png')

This gives me table but also the empty XY plot above the same. Refer the attached png image. Can any one please let me know how to remove this empty plot ?

 
Thanks and Regards,
Hussain Bohra
Tavant Technologies,
Bangalore-95
mail-to:hussain.bohra at tavant.com
mobile : +91 99867 95727


      Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! http://downloads.yahoo.com/in/internetexplorer/


More information about the BangPypers mailing list