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

Cleanup _pylab_helpers.#13581

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 1 commit intomatplotlib:masterfromanntzer:pylab_helpers
Sep 18, 2019
Merged

Conversation

anntzer
Copy link
Contributor

_activeQue + figs can be combined into a single OrderedDict.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

"""Destroy figure *fig*."""
canvas = getattr(fig, "canvas", None)
manager = getattr(canvas, "manager", None)
num = getattr(manager, "num", None)
Copy link
Member

Choose a reason for hiding this comment

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

Is this always equivalent, since it seems to be working in reverse?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This basically getsfig.canvas.manager.num with the provision that each of these can be None. If this num is not registered in thefigs dict,destroy will catch that as it first checkscls.has_fignum(num).
It's true that this may cause problems if two managers share the same num, but then the num->manager mapping is already invalid (set_active will already have overwritten the entry in the dict) so I'm not too worried about that.

*_activeQue*:
list of *managers*, with active one at the end

Singleton to handle a set of "numbered" figures and managers, and keep
Copy link
Member

Choose a reason for hiding this comment

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

I find the whole docstring a bit unclear. It seems to assume prior knowledge on figures, figure managers and their relation. Would this be a more complete description?

    Singleton to maintain the relation between figures and their managers, and    keep track of and "active" figure and manager.    When created via pyplot, a figure is associated with its own figure    manager, that handles the interaction between the figure and the backend.    This association is established via a unique identifier, called    *figure number* or *manager number*. While figure numbers are often actual    numbers, they can actually be any hashable value. The number is attached    to the figure via the `.Figure.number` attribute; and it's mapped to a    manager in the `.Gcf.figs` dictionary.    This class is never instantiated; it consists of an `OrderedDict` mapping    figure/manager numbers to managers, and a set of class methods that    manipulate this `OrderedDict`.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Actually the number is an attribute of the manager (which is itself an attribute of the canvas), but other than that, looks good. Will incorporate a slightly edited version.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Pushed edited version. (Note that the identifier does not create the association, it's just used for bookkeeping.)

@ImportanceOfBeingErnestImportanceOfBeingErnest mentioned this pull requestMar 16, 2019
6 tasks
@anntzeranntzer mentioned this pull requestApr 24, 2019
6 tasks
_activeQue + figs can be combined into a single OrderedDict.
@QuLogic
Copy link
Member

Two approvals...

@QuLogicQuLogic added this to thev3.3.0 milestoneSep 18, 2019
@QuLogicQuLogic merged commit1285c42 intomatplotlib:masterSep 18, 2019
@anntzeranntzer deleted the pylab_helpers branchSeptember 18, 2019 08:41
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestAug 5, 2020
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestAug 10, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@QuLogic@timhoffm@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp