@@ -386,6 +386,7 @@ def _get_image_inclusion_command():
386
386
387
387
class RendererPgf (RendererBase ):
388
388
389
+ @cbook ._delete_parameter ("3.3" ,"dummy" )
389
390
def __init__ (self ,figure ,fh ,dummy = False ):
390
391
"""
391
392
Creates a new PGF renderer that translates any drawing instruction
@@ -412,13 +413,6 @@ def __init__(self, figure, fh, dummy=False):
412
413
for m in RendererPgf .__dict__ :
413
414
if m .startswith ("draw_" ):
414
415
self .__dict__ [m ]= lambda * args ,** kwargs :None
415
- else :
416
- # if fh does not belong to a filename, deactivate draw_image
417
- if not hasattr (fh ,'name' )or not os .path .exists (fh .name ):
418
- self .__dict__ ["draw_image" ]= \
419
- lambda * args ,** kwargs :cbook ._warn_external (
420
- "streamed pgf-code does not support raster graphics, "
421
- "consider using the pgf-to-pdf option" )
422
416
423
417
@cbook .deprecated ("3.2" )
424
418
@property
@@ -646,6 +640,11 @@ def draw_image(self, gc, x, y, im, transform=None):
646
640
if w == 0 or h == 0 :
647
641
return
648
642
643
+ if not os .path .exists (getattr (self .fh ,"name" ,"" )):
644
+ cbook ._warn_external (
645
+ "streamed pgf-code does not support raster graphics, consider "
646
+ "using the pgf-to-pdf option." )
647
+
649
648
# save the images to png files
650
649
path = pathlib .Path (self .fh .name )
651
650
fname_img = "%s-img%d.png" % (path .stem ,self .image_counter )
@@ -756,16 +755,11 @@ def points_to_pixels(self, points):
756
755
# docstring inherited
757
756
return points * mpl_pt_to_in * self .dpi
758
757
759
- def new_gc (self ):
760
- # docstring inherited
761
- return GraphicsContextPgf ()
762
-
763
758
759
+ @cbook .deprecated ("3.3" ,alternative = "GraphicsContextBase" )
764
760
class GraphicsContextPgf (GraphicsContextBase ):
765
761
pass
766
762
767
- ########################################################################
768
-
769
763
770
764
class TmpDirCleaner :
771
765
remaining_tmpdirs = set ()
@@ -949,7 +943,7 @@ def print_png(self, fname_or_fh, *args, **kwargs):
949
943
self ._print_png_to_fh (file ,* args ,** kwargs )
950
944
951
945
def get_renderer (self ):
952
- return RendererPgf (self .figure ,None , dummy = True )
946
+ return RendererPgf (self .figure ,None )
953
947
954
948
955
949
class FigureManagerPgf (FigureManagerBase ):