diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 9d01f603e021..355090608c0c 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -635,9 +635,9 @@ def draw_image(self, gc, x, y, im, transform=None): return if not os.path.exists(getattr(self.fh, "name", "")): - _api.warn_external( + raise ValueError( "streamed pgf-code does not support raster graphics, consider " - "using the pgf-to-pdf option.") + "using the pgf-to-pdf option") # save the images to png files path = pathlib.Path(self.fh.name)