[Matplotlib-users] How to close plot window in interactive mode?

Hi!
I'm searching for a way to close (programmatically) a plot window in
interactive mode.
What is the best way?

···

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

Oh, you are searching, you say... Why not (with plt meaning matplotlib.pyplot):

plt.close(myFigure)

To see if it is the best or not... read the manual perhaps?... For example

https://matplotlib.org/api/_as_gen/matplotlib.pyplot.close.html

Google gives you 1 050 000 results if you type "matplotlib close window"!

Jerzy Karczmarczuk
/Caen, France/

···

Le 30/06/2020 à 20:30, Gilles Allard a écrit :

I'm searching for a way to close (programmatically) a plot window in
interactive mode.
What is the best way?

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

If the figure was created through the pyplot interface (e.g., plt.figure(), plt.subplots()), then plt.close(fig)) is the best way to close it programmatically both in the interactive and non-interactive modes. If the figure was constructed directly without pyplot, then that is a fair bit trickier to do, depending on the context of the code.

Ben Root

···

On Tue, Jun 30, 2020 at 2:55 PM Gilles Allard <gallard@digimicro.ca> wrote:

Hi!
I’m searching for a way to close (programmatically) a plot window in
interactive mode.
What is the best way?


Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

Hi Jerzy,

···

On Tue, 30 Jun 2020, at 2:58 PM, Jerzy Karczmarczuk wrote:

Le 30/06/2020 à 20:30, Gilles Allard a écrit :
> I'm searching for a way to close (programmatically) a plot window in
> interactive mode.
> What is the best way?

Oh, you are searching, you say... Why not (with plt meaning
matplotlib.pyplot):

plt.close(myFigure)

To see if it is the best or not... read the manual perhaps?... For example

https://matplotlib.org/api/_as_gen/matplotlib.pyplot.close.html

Google gives you 1 050 000 results if you type "matplotlib close window"!

1M results is a lot of noise to wade through. Additionally, it is a well-documented problem that a lot of Matplotlib answers on the web are out of date and use APIs that are no longer recommended by the core team. It is not reasonable to expect new users to be as effective at cutting through that noise as more experienced ones. Nor is it reasonable to expect everyone to have read through *all* the very extensive matplotlib documentation before daring to post to the list.

For example, if I click on your link to `plt.close`, I might reasonably follow through to the `Intro to pyplot` tutorial, which uses the Matplotlib state machine interface rather than the currently-recommended OO interface. I know that the OO interface is recommended only because I have years of experience with Matplotlib, but there is a good chance that newcomers would not have heard this recommendation.

This is exactly where the Matplotlib users list can help, but only *if* we are welcoming and encouraging to newcomers, rather than drive them to never post to the list again, or worse, away from this community altogether.

In short, if you want to "teach users to fish", that's fine, I get that. But this can be done with encouragement and direction rather than sarcasm and scorn.

Juan.
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

I answered somewhat brutally (but I answered!) a question about closing a window in Matplotlib. I got the following reproach:

···

On 01/07/2020 3:54 am, Juan Nunez-Iglesias wrote:

No Sir, your humane attitude wrt people who ask trivial questions on this, and on thousands of other list is defendable, but I have reasons to disagree with your teaching me manners. Here’s why…

  1. Sarcasm need not be treated as an attack. In the concerned context is the community defence. You sweep over a widely open door, remainding us that:

  2. There is an official documentation for Matplotlib, well indexed and structured. I strongly believe that such lists as this one has a pedagogic role, and may be very, very helpful to beginners, but a good answer to a (seemingly) trivial question is to provide a good link, not an off-the-shelf banal, pre-digested solution.

  3. Sorry for being egotistic, and speak about myself, but I taught thousands of students… (half a century of teaching…). After some time I simply refused to answer some questions, demanding often some additional details, such as

    • what did you REALLY try to find the solution of your problem?
    • What is the context of your issues? Your platform, OS version, packages used versions…
    • SHow me your codes
      And in many, many cases my students encouraged (or “forced”) to prepare a complete dossier with their problem, found themselves the solution.
  4. The horrible Stack Overflow is reputed for their lack of tolerance, many people don’t like it, neither do I. But we must acknowledge that they succesfully protect themselves from avalanches of repetitive trivial questions. You don’t find therein many “cases” which pollute - for example - the Anaconda mailing list, where it is not rar****e to find questions similar to: “I downloaded Anaconda, it doesn’t work. What shall I do”. Seriously! So, dear Juan Nunez-Iglesias, what would you answer, without being sarcastic, and without being trivial, demanding the details, asking whether the “victim” followed some instruction, etc.?

Sorry for this long post, thank you for the “inspiration”…

Jerzy Karczmarczuk
/Caen, France/


Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com

if you want to "teach users to fish", that's fine, I get that. But this can be done with encouragement and direction rather than sarcasm and scorn.

“1M results is a lot of noise to wade through. Additionally, it is a well-documented problem that a lot of Matplotlib answers on the web are out of date and use APIs that are no longer recommended by the core team. It is not reasonable to expect new users to be as effective at cutting through that noise as more experienced ones. Nor is it reasonable to expect everyone to have read through the very extensive matplotlib documentation before daring to post to the list.” Did you ever ask yourself WHY there is so much noise, and why beginners have difficulties to squeeze through useless “information”? A substantial part of the reason is that too many people don’t read documentation, and lazily ask the mailing lists, etc. to solve the problem for them. I hope you don’t think that I am as silly as to ask G.A. to read 1e6 answers. Every “nice” and “pedagogic” response adds to this noise, and increases the global level of laziness. And such answers, often incomplete, will remain on the Web for years.

all**

Please, don’t be trivial: nobody needs all the documentation, but even my 8 years old granddaughter is able to ask a simple question on Internet, Google etc. is for that. What proficiency do you need to ask “how to close a window in Matplotlib”? The questioner began with the affirmation that he searched for the answer. Difficult to believe, no, he didn’t search anything at all… Shall we encourage such attitudes, and amplify this social disease? Sorry Sir, but I believe that those “helpful answerers” serve the devil.

Jerzy,

We should strive to make this list a welcoming place. If a user’s question bothers you, I encourage you to ignore it and find a more productive use of your time.

-paul

···

On Wed, Jul 1, 2020 at 1:11 AM Jerzy Karczmarczuk <jerzy.karczmarczuk@unicaen.fr> wrote:

I answered somewhat brutally (but I answered!) a question about closing a window in Matplotlib. I got the following reproach:

On 01/07/2020 3:54 am, Juan Nunez-Iglesias wrote:

if you want to "teach users to fish", that's fine, I get that. But this can be done with encouragement and direction rather than sarcasm and scorn.

No Sir, your humane attitude wrt people who ask trivial questions on this, and on thousands of other list is defendable, but I have reasons to disagree with your teaching me manners. Here’s why…

  1. Sarcasm need not be treated as an attack. In the concerned context is the community defence. You sweep over a widely open door, remainding us that:

    “1M results is a lot of noise to wade through. Additionally, it is a well-documented problem that a lot of Matplotlib answers on the web are out of date and use APIs that are no longer recommended by the core team. It is not reasonable to expect new users to be as effective at cutting through that noise as more experienced ones. Nor is it reasonable to expect everyone to have read through all the very extensive matplotlib documentation before daring to post to the list.”

    Did you ever ask yourself WHY there is so much noise, and why beginners have difficulties to squeeze through useless “information”? A substantial part of the reason is that too many people don’t read documentation, and lazily ask the mailing lists, etc. to solve the problem for them. I hope you don’t think that I am as silly as to ask G.A. to read 1e6 answers. Every “nice” and “pedagogic” response adds to this noise, and increases the global level of laziness. And such answers, often incomplete, will remain on the Web for years.

  2. Please, don’t be trivial: nobody needs all the documentation, but even my 8 years old granddaughter is able to ask a simple question on Internet, Google etc. is for that. What proficiency do you need to ask “how to close a window in Matplotlib”? The questioner began with the affirmation that he searched for the answer. Difficult to believe, no, he didn’t search anything at all… Shall we encourage such attitudes, and amplify this social disease? Sorry Sir, but I believe that those “helpful answerers” serve the devil.

  3. There is an official documentation for Matplotlib, well indexed and structured. I strongly believe that such lists as this one has a pedagogic role, and may be very, very helpful to beginners, but a good answer to a (seemingly) trivial question is to provide a good link, not an off-the-shelf banal, pre-digested solution.

  4. Sorry for being egotistic, and speak about myself, but I taught thousands of students… (half a century of teaching…). After some time I simply refused to answer some questions, demanding often some additional details, such as

    • what did you REALLY try to find the solution of your problem?
    • What is the context of your issues? Your platform, OS version, packages used versions…
    • SHow me your codes
      And in many, many cases my students encouraged (or “forced”) to prepare a complete dossier with their problem, found themselves the solution.
  5. The horrible Stack Overflow is reputed for their lack of tolerance, many people don’t like it, neither do I. But we must acknowledge that they succesfully protect themselves from avalanches of repetitive trivial questions. You don’t find therein many “cases” which pollute - for example - the Anaconda mailing list, where it is not rar****e to find questions similar to: “I downloaded Anaconda, it doesn’t work. What shall I do”. Seriously! So, dear Juan Nunez-Iglesias, what would you answer, without being sarcastic, and without being trivial, demanding the details, asking whether the “victim” followed some instruction, etc.?

Sorry for this long post, thank you for the “inspiration”…

Jerzy Karczmarczuk
/Caen, France/


Avast logo |

This email has been checked for viruses by Avast antivirus software.
www.avast.com

|

  • | - |

Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

Jerzy,

I agree with both Juan and Paul.

There is no place for sarcasm or scorn on our mailing list (or any of our spaces). We follow the PSF Code of Conduct ( https://www.python.org/psf/conduct/ ). Your initial email (which you call “brutal”) is not considerate, respectful, or professional and is not appropriate for this list.

This is not the first time you have been rebuked [1], but given this defense of your behavior I see that I was giving you too much benefit of the doubt.

If you can not bring yourself to answer questions on the mailing list in a respectful, considerate, and professional manner, please do not answer at all.

Tom

[1] https://mail.python.org/pipermail/matplotlib-users/2020-May/001891.html

···

Thomas Caswell
tcaswell@gmail.com