8000 New mode between non-interactive and interactive? · Issue #11725 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
New mode between non-interactive and interactive? #11725
Closed
@fredrik-1

Description

@fredrik-1

I think that it would be useful to have a third interactive mode. It already kind of exist when %matplotlib attach the _needmain attribute to plt.show but it is kind of hacky because of the need for a try block and there is no information about the property in pyplot.

I want the plt.show() behavior when %matplotlib has been used without the need to use IPython or %matplotlib because I don't think that it make sense to let plt.show() block by default in an interactive python session.

In detail I propose the following:

  • non-interactive mode
    -plt.show() block by default
  • in between mode
    • as non-interactive mode with the difference that plt.show() don't block by default.
  • interactive mode as it is today.

This would result in a consistent behavior between vanilla python and IPython with and without %matplotlib.

This can of course also just be a property on plt.show.

I believe this would be useful when running the same scripts in different ways so that you don't need to change the plt.show block parameter. The problematic case is if you want to run python interactively but matplotlib non-interactive. Then is it necessary to use plt.show(False) to get expected behavior and change this if you want to run the same script in non-interactive python.

It might even be possibly to get this behavior by default if matplotlib knows if the python session is interactive or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0