Save a `.Figure` to this file as a new page. Any other keyword arguments are passed to `~.Figure.savefig`. Parameters ---------- figure : `.Figure` or int, default: the active figure The figure, or index of the figure, that is saved to the file.
(self, figure=None, **kwargs)
| 2676 | return self._ensure_file().infoDict |
| 2677 | |
| 2678 | def savefig(self, figure=None, **kwargs): |
| 2679 | """ |
| 2680 | Save a `.Figure` to this file as a new page. |
| 2681 | |
| 2682 | Any other keyword arguments are passed to `~.Figure.savefig`. |
| 2683 | |
| 2684 | Parameters |
| 2685 | ---------- |
| 2686 | figure : `.Figure` or int, default: the active figure |
| 2687 | The figure, or index of the figure, that is saved to the file. |
| 2688 | """ |
| 2689 | if not isinstance(figure, Figure): |
| 2690 | if figure is None: |
| 2691 | manager = Gcf.get_active() |
| 2692 | else: |
| 2693 | manager = Gcf.get_fig_manager(figure) |
| 2694 | if manager is None: |
| 2695 | raise ValueError(f"No figure {figure}") |
| 2696 | figure = manager.canvas.figure |
| 2697 | # Force use of pdf backend, as PdfPages is tightly coupled with it. |
| 2698 | figure.savefig(self, format="pdf", backend="pdf", **kwargs) |
| 2699 | |
| 2700 | def get_pagecount(self): |
| 2701 | """Return the current number of pages in the multipage pdf file.""" |
nothing calls this directly
no test coverage detected