I want to print a graph that updates itself automatically, when run on Spyder. I keep trying to use the matplotlib animation but every time after asking for inputs, instead of plotting the graph, it just shows:
matplotlib is currently using a non-GUI backend, so cannot show the figure
Am I doing something wrong in the code here?
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import math
amp=int(input("Please Enter the amplitude-"))
omeg=int(input("Please enter the angular frequency-"))
phdiff=int(input("Please enter the phase difference-"))
t=0
fig=plt.figure()
ax1=fig.add_subplot(111)
def animate(i):
global t
y=amp*math.sin((omeg*t)+phdiff)
fig.clear()
ax1.plot(t,y)
t+=1
animated=anim.FuncAnimation(fig,animate,interval=1000)
fig.show()