Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python libraries to generate charts and save as image file

I require to generate bar charts and then save them as images, in .png or .bmp format. Can anyone please point me to such libraries.

My basic need is to generate bar charts in an excel report.

I thought of generating bar charts from any chart library as image files and then insert them into the excel report i am generating using xlwt library.

Please let me know if there is a better way to achieve this objective.

** I had read about pygooglechart module, but i think we need internet connection to generate charts and then download them. Please correct me if i am wrong about this.

like image 709
PyBegginer Avatar asked Oct 18 '25 21:10

PyBegginer


2 Answers

Have you tried Matplotlib ?

like image 147
Kien Truong Avatar answered Oct 20 '25 10:10

Kien Truong


You can save to file with pygooglechart

chart = PieChart2D(700, 400)
chart.add_data([10, 10, 30, 200])
chart.set_pie_labels([
    'Budding Chemists',
    'Propane issues',
    'Meth Labs',
    'Attempts to escape morgage',
])
chart.download('chart.png')
like image 43
id614515 Avatar answered Oct 20 '25 09:10

id614515



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!