Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commiteaf4469

Browse files
authored
Merge pull request#15977 from anntzer/pgf-cleanup
pgf backend cleanups.
2 parentsb42d6d9 +02b379c commiteaf4469

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

‎doc/api/next_api_changes/deprecations.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,9 @@ an internal helper).
338338
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339339
This method is deprecated. If needed, directly assign to the ``params``
340340
attribute of the Substitution object.
341+
342+
PGF backend cleanups
343+
~~~~~~~~~~~~~~~~~~~~
344+
The *dummy* parameter of `.RendererPgf` is deprecated.
345+
346+
`.GraphicsContextPgf` is deprecated (use `.GraphicsContextBase` instead).

‎lib/matplotlib/backends/backend_pgf.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def _get_image_inclusion_command():
386386

387387
classRendererPgf(RendererBase):
388388

389+
@cbook._delete_parameter("3.3","dummy")
389390
def__init__(self,figure,fh,dummy=False):
390391
"""
391392
Creates a new PGF renderer that translates any drawing instruction
@@ -412,13 +413,6 @@ def __init__(self, figure, fh, dummy=False):
412413
forminRendererPgf.__dict__:
413414
ifm.startswith("draw_"):
414415
self.__dict__[m]=lambda*args,**kwargs:None
415-
else:
416-
# if fh does not belong to a filename, deactivate draw_image
417-
ifnothasattr(fh,'name')ornotos.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")
422416

423417
@cbook.deprecated("3.2")
424418
@property
@@ -646,6 +640,11 @@ def draw_image(self, gc, x, y, im, transform=None):
646640
ifw==0orh==0:
647641
return
648642

643+
ifnotos.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+
649648
# save the images to png files
650649
path=pathlib.Path(self.fh.name)
651650
fname_img="%s-img%d.png"% (path.stem,self.image_counter)
@@ -756,16 +755,11 @@ def points_to_pixels(self, points):
756755
# docstring inherited
757756
returnpoints*mpl_pt_to_in*self.dpi
758757

759-
defnew_gc(self):
760-
# docstring inherited
761-
returnGraphicsContextPgf()
762-
763758

759+
@cbook.deprecated("3.3",alternative="GraphicsContextBase")
764760
classGraphicsContextPgf(GraphicsContextBase):
765761
pass
766762

767-
########################################################################
768-
769763

770764
classTmpDirCleaner:
771765
remaining_tmpdirs=set()
@@ -949,7 +943,7 @@ def print_png(self, fname_or_fh, *args, **kwargs):
949943
self._print_png_to_fh(file,*args,**kwargs)
950944

951945
defget_renderer(self):
952-
returnRendererPgf(self.figure,None,dummy=True)
946+
returnRendererPgf(self.figure,None)
953947

954948

955949
classFigureManagerPgf(FigureManagerBase):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp