Enable interactive mode. See `.pyplot.isinteractive` for more details. See Also -------- ioff : Disable interactive mode. isinteractive : Whether interactive mode is enabled. show : Show all figures (and maybe block). pause : Show all figures, and block for a time.
()
| 725 | # See https://github.com/matplotlib/matplotlib/issues/27659 |
| 726 | # and https://github.com/matplotlib/matplotlib/pull/27667 for more info. |
| 727 | def ion() -> AbstractContextManager: |
| 728 | """ |
| 729 | Enable interactive mode. |
| 730 | |
| 731 | See `.pyplot.isinteractive` for more details. |
| 732 | |
| 733 | See Also |
| 734 | -------- |
| 735 | ioff : Disable interactive mode. |
| 736 | isinteractive : Whether interactive mode is enabled. |
| 737 | show : Show all figures (and maybe block). |
| 738 | pause : Show all figures, and block for a time. |
| 739 | |
| 740 | Notes |
| 741 | ----- |
| 742 | For a temporary change, this can be used as a context manager:: |
| 743 | |
| 744 | # if interactive mode is off |
| 745 | # then figures will not be shown on creation |
| 746 | plt.ioff() |
| 747 | # This figure will not be shown immediately |
| 748 | fig = plt.figure() |
| 749 | |
| 750 | with plt.ion(): |
| 751 | # interactive mode will be on |
| 752 | # figures will automatically be shown |
| 753 | fig2 = plt.figure() |
| 754 | # ... |
| 755 | |
| 756 | To enable optional usage as a context manager, this function returns a |
| 757 | context manager object, which is not intended to be stored or |
| 758 | accessed by the user. |
| 759 | """ |
| 760 | stack = ExitStack() |
| 761 | stack.callback(ion if isinteractive() else ioff) |
| 762 | matplotlib.interactive(True) |
| 763 | install_repl_displayhook() |
| 764 | return stack |
| 765 | |
| 766 | |
| 767 | def pause(interval: float) -> None: |
nothing calls this directly
no test coverage detected