I have a code which gives me a output. Part of the code is given below. I am trying to plot the output "xin" vs "tstep" in realtime. The code works but it plots xin in a new window each time and its very slow. Please suggest me a way out to plot it faster and plot the data in one plot.
tstep=1
fig=plt.figure()
plt.axis([-300,400,600,0])
x=list()
y=list()
plt.ion()
plt.show()
while tstep<tend+1:
tval=tstep
phase=0
if xin<intfxpos[0]+tan(intfang[0])*t*(tstep-1):
phase=1
acount=acount+1
else:
bcount=bcount+1
x.append(xin)
y.append(tstep-1)
plt.scatter((xin),(tstep-1))
#tstep=tend+1
plt.draw()
time.sleep(0.05)
plt.pause(0.0005)