Sometimes, we want to detach matplotlib plots so that the computation can continue with Python.
In this article, we’ll look at how to detach matplotlib plots so that the computation can continue with Python.
How to detach matplotlib plots so that the computation can continue with Python?
To detach matplotlib plots so that the computation can continue with Python, we can call draw
.
For instance, we write
from matplotlib.pyplot import plot, draw, show
plot([1,2,3])
draw()
# ...
show()
to call plot
to plot a graph.
Then we call draw
to draw it on screen and be allowed to continue running the rest of the script.
Finally, we call show
at the end to show the final plot.
Conclusion
To detach matplotlib plots so that the computation can continue with Python, we can call draw
.