Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
QuLogic merged 3 commits intomatplotlib:masterfromtacaswell:fix_pgf_draw
Feb 17, 2021

Conversation

tacaswell
Copy link
Member

Previously the non-interactive backends, other than Agg, did not
definedraw 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

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • Conforms to Matplotlib style conventions (installflake8-docstrings andpydocstyle<4 and runflake8 --docstring-convention=all).

@tacaswelltacaswell added this to thev3.4.0 milestoneSep 4, 2020
Comment on lines 2703 to 2732
def draw(self, *args, **kwargs):
_no_op_draw(self.figure)
return super().draw(*args, **kwargs)
Copy link
Member

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.)

Copy link
MemberAuthor

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.

@tacaswelltacaswellforce-pushed thefix_pgf_draw branch 2 times, most recently from68fd2fe to23a306fCompareSeptember 23, 2020 15:33
@QuLogicQuLogic added Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. status: needs rebase labelsJan 21, 2021
@QuLogic
Copy link
Member

This needs a rebase, and its corresponding issue is release critical, so marking the same.

@tacaswell
Copy link
MemberAuthor

rebased.

@anntzer
Copy link
Contributor

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?

Copy link
Contributor

@anntzeranntzer left a 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.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer approved these changes

@jklymakjklymakjklymak left review comments

@QuLogicQuLogicQuLogic approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

pgf backend no longer supports fig.draw
4 participants
@tacaswell@QuLogic@anntzer@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp