FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix PdfPages+cairo. by anntzer · Pull Request #9114 · matplotlib/matplotlib · GitHub

Repository navigation

Fix PdfPages+cairo. - #9114

Merged
tacaswell merged 1 commit into
matplotlib:masterfrom
anntzer:pdfpages-cairo
Feb 11, 2018
Merged

tacaswell merged 1 commit into
matplotlib:masterfrom
anntzer:pdfpages-cairo

Conversation

anntzer commented Aug 28, 2017 •
edited
Loading

Copy link
Copy Markdown
Contributor

... by forcing pdf backend output from within PdfPages.

Fixes #9112. No tests because the only realistic use case is with cairo, which is not tested either (but #9112 is fixed when manually trying it).

Attn @OceanWolf

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

tacaswell added this to the 2.2 (next next feature release) milestone Aug 29, 2017
anntzer force-pushed the pdfpages-cairo branch 2 times, most recently from 697f479 to 170d569 Compare August 29, 2017 09:00
... by forcing pdf backend output from within PdfPages.
try:
orig_canvas = figure.canvas
figure.canvas = FigureCanvasPdf(figure)
figure.savefig(self, format="pdf", **kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What if we were already using the pdf backend? How much extra work would this create? Does the new canvas need to get explicitly destroyed to free memory?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Creating the FigureCanvasPdf is really cheap (it is defined just below -- its init is directly inherited from FigureCanvasBase, which doesn't do anything fancy either).
The temporary canvas will get GC'd per normal python semantics.

tacaswell merged commit 206b5fe into matplotlib:master Feb 11, 2018
anntzer deleted the pdfpages-cairo branch February 12, 2018 05:09
QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDFPages Errors on savefig (missing encode)

4 participants


Back | FazBrowse Home | New Git URL