Skip to content

Deprecate tostring_rgb.#25484

Merged
ksunden merged 1 commit into
matplotlib:mainfrom
anntzer:tad
Mar 17, 2023
Merged

Deprecate tostring_rgb.#25484
ksunden merged 1 commit into
matplotlib:mainfrom
anntzer:tad

Conversation

@anntzer

@anntzer anntzer commented Mar 17, 2023

Copy link
Copy Markdown
Contributor

As noted previously (#5336, see in particular the comments in the thread), silently dropping alpha can be confusing. Also, directly accessing the buffer array is more efficient (it does not involve copying to a string buffer) and should cover most use cases.

Closes #5336.

PR Summary

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

As noted previously, silently dropping alpha can be confusing.  Also,
directly accessing the buffer array is more efficient (it does not
involve copying to a string buffer) and should cover most use cases.
@anntzer anntzer added this to the v3.8.0 milestone Mar 17, 2023
@oscargus oscargus added the API: changes Changes to the public API, typically requiring deprecation. label Mar 17, 2023
self.renderer.clear()
return self.renderer

@_api.deprecated("3.8")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need any of these tostring_ methods? and even if we do, should they not be private?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also deprecate tostring_argb (which we don't use either anymore); I don't have a strong opinion here.

@ksunden ksunden merged commit b1f8b66 into matplotlib:main Mar 17, 2023
@anntzer anntzer deleted the tad branch March 17, 2023 19:30
jonorthwash added a commit to SwatPhonLab/UltraTrace that referenced this pull request Jul 8, 2025
as of matplotlib 3.8, [tostring_rgb was deprecated](matplotlib/matplotlib#25484)
as of matplotlib 3.10, tostring_rgb was removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API: changes Changes to the public API, typically requiring deprecation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RendererAgg.tostring_rgb merely truncates alpha

4 participants