Skip to content

Commit

Permalink
DOC: Suggest replacement for tostring_rgb (matplotlib#25502)
Browse files Browse the repository at this point in the history
* DOC: Suggest replacement

* DOC: Better doc

* DOC: Move
  • Loading branch information
larsoner authored Mar 23, 2023
1 parent 73f3a8b commit 2f7f62e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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 @@ -412,7 +412,7 @@ def get_renderer(self):
self._lastKey = key
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

0 comments on commit 2f7f62e

Please sign in to comment.