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