8000 Large size of plots saved as pdf · Issue #9716 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Large size of plots saved as pdf #9716
Closed
@fernando-goncalves

Description

@fernando-goncalves

Bug report

Bug summary

matplotlib version 2.1.0 generates pdf files that are a lot larger than those generated by version 2.0.2. In one case a file that looks exactly the same went from 635KB to 127MB. A simpler code sample is presented below in which the size grew from 11KB to 20KB.
Is there a way to get the size of version 2.0.2?

Code for reproduction

import matplotlib as mlp
import matplotlib.pyplot as plt

from matplotlib.backends.backend_pdf import PdfPages
from sklearn.datasets import load_iris

print(mlp.__version__)
iris = load_iris()
data = iris.data

plt.scatter(data[:,0], data[:,1])
plt.xlabel('x values')
plt.ylabel('y values')
plt.title('example')

pdf = PdfPages(r"test.pdf")
plt.savefig(pdf, format='pdf', bbox_inches = 'tight')
plt.show()
pdf.close()
pdf = None

Matplotlib version

  • Operating system:
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

conda

anaconda

Edit (@afvincent): cosmetic edit, mainly to get syntax highlighting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.backend: pdf

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0