0

In a python3 command line session, once I start plt.show(). I can not type any further python3 commands. Is there a way to make plt.show() nonblocking?

$ python3
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> x = [1, 2, 3]
>>> y = [3, 2, 1]
>>> plt.scatter(x,y)
<matplotlib.collections.PathCollection object at 0x7feb00256670>
>>> plt.show()

user1424739
  • 11,937
  • 17
  • 63
  • 152
  • Duplicate [Is there a way to detach matplotlib plots so that the computation can continue?](https://stackoverflow.com/q/458209/7758804)? – Trenton McKinney Jun 15 '21 at 21:23

1 Answers1

2

Use plt.ion() before plt.show() to enable interactive mode.

tdy
  • 36,675
  • 19
  • 86
  • 83
virxen
  • 408
  • 4
  • 12