elapouya / python-docx-template

Use a docx as a jinja2 template
GNU Lesser General Public License v2.1
2.01k stars 391 forks source link

How to add vector (from matplotlib) graphics? #244

Open richard-moss opened 4 years ago

richard-moss commented 4 years ago

Hi all,

great package! I've been looking for something like this for a week or so.

I was wondering what's the best way (or is there a way?) of including graphs produced by matplotlib as vector graphics (rather than bitmap like png or jpg)?

I want to put together some reports using the module, and include some graphs. I can include them fine right now using InlineImage() if I save them as jpg or png.

However due to the size impact on the resulting file (and poor resolution if printing) I'd prefer to do that in a vector format (svg, or pdf?).

I tried both pdf and svg with InlineImage() and it failed (I read issue #651 from python-docx about SVG support in python-docx).

So I was wondering is it possible, and how to go about, including matplotlib plots in a vector form?

thanks, Richard

elapouya commented 4 years ago

This has to be developped : mark this as enhancement