简体   繁体   中英

Fitted curve on chart using ReportLab

I'm preparing a set of reports using open source ReportLab. The reports contain a number of charts. Everything works well so far.

I've been asked to take a (working) bar chart that shows two series of data and overlay a fitted curve for each series.

I can see how I could overlay a segmented line on the bar graph by creating both a line chart and bar chart in the same ReportLab drawing. I can't find any reference for fitted curves in ReportLab, however.

Does anyone have any insight into plotting a fitted curve to a series of data in ReportLab or, failing that, a suggestion about how to accomplish this task (I'm thinking that chart would need to be produced in matplotlib instead)?

I would recommend using MatPlotLib. This is exactly the sort of thing it's designed to handle and it will be much easier than trying to piece together something in ReportLab alone, especially since you'll have to do all the calculation of the line on your own and figure out the details of how to draw it in just the right place. MatPlotLib integrates easily with ReportLab; I've used the combination several times with great results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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