[Matplotlib-users] large pdf files

Appel, Thibaut t.appel17 at imperial.ac.uk
Mon Oct 5 13:30:06 EDT 2020

If the output size of .pdf is your concern, I suggest you export your figure with matplotlib in .eps, and then use the command line tool « epstopdf » shipped with any LaTeX distribution.

The .pdf backend of matplotlib is far from being optimized.

I always observe a factor of size decrease between 10 and 100 (!) in the output .pdf after running epstopdf, instead of saving directly in pdf.

> From: fiolj <fiolj at yahoo.com>
> To: matplotlib-users <matplotlib-users at python.org>
> Subject: [Matplotlib-users] large pdf files
> Message-ID: <0886ed29-48a2-be2f-78a1-2bbab870d0ab at yahoo.com>
> Content-Type: text/plain; charset=windows-1252
> Hi, checking on sizes of pdf files I noticed that in my system currently
> pdf output are at least 370k when similar plots previously were about 20k.
> I tested with an old figure (I do not matplotlib version but was created
> about May 2019) and the figure was 15409 bytes while the same figure
> with matplotlib version 3.2.2 has a size of 429110 bytes.
> I checked and this happens even plotting a few (ten) points with line,
> everything using default values.
> My user configuration file has not been modified but my system may have
> changed.
> I've found similar reports but regarding much older versions.
> Any ideas?
>   Regards, Juan

More information about the Matplotlib-users mailing list