It’s a pretty basic question on matplotlib, but I cannot figure out how to do it :
I want to plot multiple figures and use the arrow in the plot window to move from one to another.
for the time being I just know how to create mutiple plots and plot them in different windows like this :
import matplotlib.pyplot as plt
fig = plt.figure()
plt.figure(1)
n= plt.bar([1,2,3,4],[1,2,3,4])
plt.figure(2)
n= plt.bar([1,2,3,4],[-1,-2,-3,-4])
plt.show()
or having multiple figures on the same window using subplot.
How can I have mutliple plots on the same window and move from one to the next one with the arrows ?
Thanks in advance.
To produce a plot which is updated as you press the left and right keys, you will need to handle keyboard events (docs: http://matplotlib.sourceforge.net/users/event_handling.html).
I have put together an example of updating a plot, using the pyplot interface, when you press the left and right arrows: