You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to add vector (from matplotlib) graphics? #244
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?
Activity
elapouya commentedon Dec 28, 2019
This has to be developped : mark this as enhancement
cvas22 commentedon Nov 25, 2026
@richard-moss python-docx only embeds bitmaps, so vector formats can't go through InlineImage. A high-dpi PNG is the practical workaround.
I'm keeping track of these in docform, the maintained fork of python-docx-template, if you want to follow up there.