Use LaTeX to compile a pgf figure to pdf and convert it to png.
(self, fname_or_fh, **kwargs)
| 864 | shutil.copyfileobj(orig, dest) # copy file contents to target |
| 865 | |
| 866 | def print_png(self, fname_or_fh, **kwargs): |
| 867 | """Use LaTeX to compile a pgf figure to pdf and convert it to png.""" |
| 868 | converter = make_pdf_to_png_converter() |
| 869 | with TemporaryDirectory() as tmpdir: |
| 870 | tmppath = pathlib.Path(tmpdir) |
| 871 | pdf_path = tmppath / "figure.pdf" |
| 872 | png_path = tmppath / "figure.png" |
| 873 | self.print_pdf(pdf_path, **kwargs) |
| 874 | converter(pdf_path, png_path, dpi=self.figure.dpi) |
| 875 | with (png_path.open("rb") as orig, |
| 876 | cbook.open_file_cm(fname_or_fh, "wb") as dest): |
| 877 | shutil.copyfileobj(orig, dest) # copy file contents to target |
| 878 | |
| 879 | def get_renderer(self): |
| 880 | return RendererPgf(self.figure, None) |
nothing calls this directly
no test coverage detected