In Matplotlib, I can update the visual effect of the plot in a figure by calling the Figure
object, say fig
and calling the method show
(fig.show()
). But I also can do that by calling the canvas
object in the figure and then calling method draw
(fig.canvas.draw()
).
Example:
import matplotlib.pyplot as plt
fig, axes = plt.subplots()
axes.plot([1,2,3],[2,3,4])
fig.show()
axes.plot([1,2,3],[-2,23,14])
fig.show()
and
import matplotlib.pyplot as plt
fig, axes = plt.subplots()
axes.plot([1,2,3],[2,3,4])
fig.show()
axes.plot([1,2,3],[-2,23,14])
fig.canvas.draw()
I suspected the fig.show
also performs self.canvas.draw()
and some other things. But when I checked the code, I see only that it may call self.canvas.draw_idle()
.
What is the difference between fig.show
, fig.canvas.draw
, fig.canvas.draw_idle
??