Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX/API:fig.canvas.draw
always updates internal state#18408
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
def draw(self, *args, **kwargs): | ||
_no_op_draw(self.figure) | ||
return super().draw(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I guess the superclass does nothing? It's a bit weird to do a no-op draw, and then go to the super's draw (which, from just looking at this one spot, could conceivably doanything.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In 99.9% of cases, the super-call will do nothing, but I do not want to assume that no one has done some (ill-advised?) multiple inheritance of our classes and was relying on hitting their draw.
That said, I think the name_no_op_draw
is bad because it is doing an operation (updating our internal state), just not producing any output.
68fd2fe
to23a306f
CompareThis needs a rebase, and its corresponding issue is release critical, so marking the same. |
rebased. |
Uh oh!
There was an error while loading.Please reload this page.
76f95f7
to3692ded
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Perhaps the docstrings in backend_bases and backend_template should be updated to tell third-party implementers that they need to ensure that draw() walks the artist tree? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Minor comments, but basically good.
Previously the non-interactive backends, other than Agg, did notdefine `draw` methods and fell back to the base no-op version.However, we have been documenting that the correct way to update thevarious internal state we keep (run tight/constrained layouts, autolimits, text size/position, ...), this is now a bug due to oursuggested usage drifting.closesmatplotlib#18407
Move the marks to skip if various latex installs are missing to bevisible on other modules.
The full artist tree needs to be walked in `draw` to ensure thatdeferred work is done.
Previously the non-interactive backends, other than Agg, did not
define
draw
methods and fell back to the base no-op version.However, we have been documenting that the correct way to update the
various internal state we keep (run tight/constrained layouts, auto
limits, text size/position, ...), this is now a bug due to our
suggested usage drifting.
closes#18407
I could be convinced that this should actually be backported for 3.3.2
I'm mixed if these needs an API change note or not.
PR Summary
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
andpydocstyle<4
and runflake8 --docstring-convention=all
).