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

pgf backend cleanups.#15977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromanntzer:pgf-cleanup
Mar 14, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletionsdoc/api/next_api_changes/deprecations.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,3 +338,9 @@ an internal helper).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This method is deprecated. If needed, directly assign to the ``params``
attribute of the Substitution object.

PGF backend cleanups
~~~~~~~~~~~~~~~~~~~~
The *dummy* parameter of `.RendererPgf` is deprecated.

`.GraphicsContextPgf` is deprecated (use `.GraphicsContextBase` instead).
22 changes: 8 additions & 14 deletionslib/matplotlib/backends/backend_pgf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -386,6 +386,7 @@ def _get_image_inclusion_command():

class RendererPgf(RendererBase):

@cbook._delete_parameter("3.3", "dummy")
def __init__(self, figure, fh, dummy=False):
"""
Creates a new PGF renderer that translates any drawing instruction
Expand All@@ -412,13 +413,6 @@ def __init__(self, figure, fh, dummy=False):
for m in RendererPgf.__dict__:
if m.startswith("draw_"):
self.__dict__[m] = lambda *args, **kwargs: None
else:
# if fh does not belong to a filename, deactivate draw_image
if not hasattr(fh, 'name') or not os.path.exists(fh.name):
self.__dict__["draw_image"] = \
lambda *args, **kwargs: cbook._warn_external(
"streamed pgf-code does not support raster graphics, "
"consider using the pgf-to-pdf option")

@cbook.deprecated("3.2")
@property
Expand DownExpand Up@@ -646,6 +640,11 @@ def draw_image(self, gc, x, y, im, transform=None):
if w == 0 or h == 0:
return

if not os.path.exists(getattr(self.fh, "name", "")):
cbook._warn_external(
"streamed pgf-code does not support raster graphics, consider "
"using the pgf-to-pdf option.")

# save the images to png files
path = pathlib.Path(self.fh.name)
fname_img = "%s-img%d.png" % (path.stem, self.image_counter)
Expand DownExpand Up@@ -756,16 +755,11 @@ def points_to_pixels(self, points):
# docstring inherited
return points * mpl_pt_to_in * self.dpi

def new_gc(self):
# docstring inherited
return GraphicsContextPgf()


@cbook.deprecated("3.3", alternative="GraphicsContextBase")
class GraphicsContextPgf(GraphicsContextBase):
pass

########################################################################


class TmpDirCleaner:
remaining_tmpdirs = set()
Expand DownExpand Up@@ -949,7 +943,7 @@ def print_png(self, fname_or_fh, *args, **kwargs):
self._print_png_to_fh(file, *args, **kwargs)

def get_renderer(self):
return RendererPgf(self.figure, None, dummy=True)
return RendererPgf(self.figure, None)


class FigureManagerPgf(FigureManagerBase):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp