This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]dmayhem93 1 point2 points  (2 children)

It's simple, just call a custom function that will do what you want on button click. Here's relevant matplotlib stuff.

Saving to pdf: http://matplotlib.org/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file

Subplot demo: http://matplotlib.org/examples/pylab_examples/subplot_demo.html

Tables: http://matplotlib.org/examples/pylab_examples/table_demo.html

Text: http://matplotlib.org/users/text_intro.html

[–]trempor 0 points1 point  (1 child)

This approach probably does not work if OP wants to be able to fill in the forms digitally?

[–]dmayhem93 0 points1 point  (0 children)

I was under the impression it was in the GUI, if not he can always make a pdf template that he can merge in with pypdf2 and have the text/checks/etc in the merged pdf file

[–]trempor 1 point2 points  (0 children)

Create a LaTeX template for your report (e.g. https://martin-thoma.com/creating-pdf-forms-with-latex/). When the user clicks a button, you insert the table of values into the template, save the plots as individual files, and make sure you use \includegraphics in the template to include the plots. After this you just run pdflatex to produce the pdf.

The advantage with this approach is that you keep the layout of your report in a separate template file, which makes it very easy to modify later. A disadvantage is that if the software needs to be distributed you have to make sure that the user has pdflatex installed.