Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9ff8910

Browse filesBrowse files
committed
Replace pgf image-streaming warning by error.
Saving a pgf file with images to an in-memory buffer (`import io; imshow([[1, 2]]); savefig(io.BytesIO(), format="pgf")`) currently warns that this is not possible (because the image needs to be written to the filesyste), but in fact an exception gets raised immediately after when trying to construct `Path(self.fh.name)`, so we may as well replace the original warning by an exception.
1 parent de2ea8b commit 9ff8910
Copy full SHA for 9ff8910

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎lib/matplotlib/backends/backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,9 @@ def draw_image(self, gc, x, y, im, transform=None):
624624
return
625625

626626
if not os.path.exists(getattr(self.fh, "name", "")):
627-
_api.warn_external(
627+
raise ValueError(
628628
"streamed pgf-code does not support raster graphics, consider "
629-
"using the pgf-to-pdf option.")
629+
"using the pgf-to-pdf option")
630630

631631
# save the images to png files
632632
path = pathlib.Path(self.fh.name)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.