FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

standard key for closing figure ("q") · Issue #830 · matplotlib/matplotlib · GitHub

Repository navigation

standard key for closing figure ("q") #830

Closed

Description

For consistency with other plotting programs (such as gnuplot), I would love to have "q" as a standard key for closing a figure window.

Activity

  1. pelson commented on Apr 16, 2012

    Member

    I have a little recipe for you which does what you want.

    import matplotlib.pyplot as plt
    
    plt.plot(range(10))
    
    def quit_figure(event):
        if event.key == 'q':
            plt.close(event.canvas.figure)
    
    cid = plt.gcf().canvas.mpl_connect('key_press_event', quit_figure)
    
    plt.show()
    

    Obviously, this doesn't give you what you asked for on all plots...

  2. birkenfeld commented on Apr 16, 2012

    Author

    Yes, I'm already doing that for most larger scripts where it doing the work feels justified. It would just be nice to have it by default.

  3. pelson commented on Jul 5, 2012

    Member

    Fixed in #851, by default you can now close a figure with "ctrl+w" on most backends.

  4. hbaromega commented on Aug 8, 2015

    @pelson what did you mean by "Added a close figure key ("q" by default)" ? Where did you do the modification (inside some file?) ?

  5. pelson commented on Aug 27, 2015

    Member

    @pelson what did you mean by "Added a close figure key ("q" by default)" ?

    All matplotlib figures can be closed with "ctrl + w" / "cmd + w" since a good number of years.

    The changes (rather broadly) were done in #851. The specific file which changed: https://github.com/matplotlib/matplotlib/pull/851/files#diff-546df25a362e568e615b2a0558df2cbeR585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL