简体   繁体   English

如何在python中生成具有饼图的报告?

[英]How to generate a report having a pie chart in python?

I'm using ReportLab for generating reports in PDF. 我正在使用ReportLab生成PDF报告。 I'm able to get a pdf havinf only textual content in it, but I want to represent the information in the form of a pie chart. 我只能在其中获取文本的pdf havinf内容,但我想以饼图的形式表示信息。

Here is the information that I want to represent on the pie chart. 这是我想在饼图中表示的信息。

[[New Delhi,110kWh],[Bangalore,200kWh]

ie a pir should have regions of New Delhi and Bangalore with their respective values in percentage. 也就是说,一个pir应该具有新德里和班加罗尔的地区,并分别以百分比表示。

How can I bring a pie chart into the PDF for generation of reports. 如何将饼形图带入PDF以生成报告。

You can use matplotlib to generate a pie chart. 您可以使用matplotlib生成饼图。 See the example here . 请参阅此处的示例。

Save the chart as a image file and place it in your PDF. 将图表另存为图像文件,并将其放置在PDF中。

you can use this tutorial for creating pie-chart using ReportLab : http://www.reportlab.com/snippets/2/ 您可以使用本教程使用ReportLab创建饼图: http : //www.reportlab.com/snippets/2/

For other types of scientific or data visualizations matplotlib is also good. 对于其他类型的科学或数据可视化,matplotlib也不错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM