Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve documentation on rasterization #18969

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
Nov 20, 2020

Conversation

timhoffm
Copy link
Member

PR Summary

Inspired by, but independent of #18956.


Defaults to None, which implies the backend's default behavior.
Copy link
Member Author

Choose a reason for hiding this comment

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

AFAICS, there is no explicit "backend's default behavior". The mechanism seems entirely controlled by the Artist's draw method (via @allow_rasterization). The backend/renderer only implements start_rasterizing / stop_rasterizing (or not if thy do not support rasterization, which leaves these functions as no-ops).

The only "default" is that pixel-based backends ignore this setting, and vector backends respect it.

Also, it seems that the value of None is never checked explicitly, but we only have a a truthy comparison if self._rasterized. Therefore, we make this a real bool parameter. - Would need to change the default init value as well, which is a non-doc change, and if we wanted to be nit-picky also is an API change, because get_rasterized would return another value. So I leave this for another PR.

Copy link
Member

Choose a reason for hiding this comment

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

I suspect that this wording means "in Agg we _always_rasterize, in svg the default is to emit vector data", i.e. the default value is to do what ever the backend does (at least that is how I have always read).

Copy link
Member Author

@timhoffm timhoffm Nov 19, 2020

Choose a reason for hiding this comment

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

👍 "backend's default behavior" is still a bit weird wording. To me, "default" implies that one can configure it to something else.

Anyway, the wording is gone. And a possible removal of None is for another PR.

timhoffm and others added 2 commits November 20, 2020 10:47
Co-authored-by: Elliott Sales de Andrade <[email protected]>
Co-authored-by: Elliott Sales de Andrade <[email protected]>
@timhoffm
Copy link
Member Author

I've committed @QuLogic's changes via GitHub interface. Please squash-merge.

@timhoffm timhoffm merged commit e097bf4 into matplotlib:master Nov 20, 2020
@timhoffm timhoffm deleted the doc-rasterization branch November 20, 2020 10:47
@QuLogic QuLogic added this to the v3.4.0 milestone Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants