Skip to content

DOC: Suggest replacement for tostring_rgb #25502

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
``RendererAgg.tostring_rgb`` and ``FigureCanvasAgg.tostring_rgb``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... are deprecated with no replacement.
... are deprecated with no direct replacement. Consider using ``buffer_rgba``
instead, which should cover most use cases.
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def buffer_rgba(self):
def tostring_argb(self):
return np.asarray(self._renderer).take([3, 0, 1, 2], axis=2).tobytes()

@_api.deprecated("3.8")
@_api.deprecated("3.8", alternative="buffer_rgba")
def tostring_rgb(self):
return np.asarray(self._renderer).take([0, 1, 2], axis=2).tobytes()

Expand Down Expand Up @@ -415,7 +415,7 @@ def get_renderer(self, cleared=False):
self.renderer.clear()
return self.renderer

@_api.deprecated("3.8")
@_api.deprecated("3.8", alternative="buffer_rgba")
def tostring_rgb(self):
"""
Get the image as RGB `bytes`.
Expand Down