Skip to content

protecting figure with matplotlib widgets #984

Closed

Description

@pavoljuhas

Ubuntu Linux 10.04, matplotlib version: 0.99.1.1, backend GtkAgg;
probably the same in all later versions

There seems to be no way of protecting a GUI-only figure containing
matplotlib widgets. If this figure becomes active, any pyplot command
will draw over the widgets. As an example, this happens in the built-in
subplot_tool function where the plot command draws into the Reset box:

$ ipython -pylab
In [1]: subplot_tool()
# click any slider
In [2]: plot(range(2))

MATLAB deals with this issue by having a HandleVisibility and IntegerHandle
properties, which prevent a GUI figure from becoming the active one and protect
it from accidental changes. It would be surely useful to have some similar
option of protecting GUI figures in matplotlib.

Activity

  1. ghost assigned on Aug 19, 2012
  2. tacaswell commented on Jan 16, 2014

    @tacaswell
    Member

    Should be addressed in the #2624 or #2736 work. The simplest fix is a way to exclude/remove a figure from gcf_helper.

  3. pavoljuhas commented on Jan 17, 2014

    @pavoljuhas
    ContributorAuthor

    Could you please be more specific and provide an example of creating protected figure?
    Is there some way of setting figure protection after subplot_tool() creates its window?

  4. tacaswell commented on Jan 17, 2014

    @tacaswell
    Member

    Sorry, that comment is mostly a note to my self to make linkages from those issues to this one.

    By 'should' here I mean 'remember to make it able to do this'.

    The safest way is to use the OO interface, not pyplot, that way you never are surprised about where it plots.

  5. petehuang commented on Jan 6, 2017

    @petehuang
    Contributor

    #2624 linked to MEP27/#4143, just tossing a link here.

  6. modified the milestones: , on Sep 24, 2017
  7. QuLogic commented on Apr 22, 2020

    @QuLogic
    Member

    This seems to have been fixed since at least 2.0, as calling subplot_tool opens a (empty) figure which becomes active instead of it, so nothing is drawn on the Reset button.

  8. removed this from the future releases milestone on Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions