Is there a matplotlib flowable for ReportLab?

Here’s a solution using pdfrw: #!/usr/bin/env python # encoding: utf-8 “””matplotlib_example.py An simple example of how to insert matplotlib generated figures into a ReportLab platypus document. “”” import matplotlib matplotlib.use(‘PDF’) import matplotlib.pyplot as plt import cStringIO from pdfrw import PdfReader from pdfrw.buildxobj import pagexobj from pdfrw.toreportlab import makerl from reportlab.platypus import Flowable from reportlab.lib.enums import … Read more

Export Pandas DataFrame into a PDF file using Python

First plot table with matplotlib then generate pdf import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages df = pd.DataFrame(np.random.random((10,3)), columns = (“col 1”, “col 2”, “col 3″)) #https://stackoverflow.com/questions/32137396/how-do-i-plot-only-a-table-in-matplotlib fig, ax =plt.subplots(figsize=(12,4)) ax.axis(‘tight’) ax.axis(‘off’) the_table = ax.table(cellText=df.values,colLabels=df.columns,loc=”center”) #https://stackoverflow.com/questions/4042192/reduce-left-and-right-margins-in-matplotlib-plot pp = PdfPages(“foo.pdf”) pp.savefig(fig, bbox_inches=”tight”) pp.close() reference: How do I … Read more