Rescaling axes with animation in the matplotlib package in Python -


i'm having trouble getting axes autoscale dynamically animation using matplotlib.animation in python. below except code:

def _update_plot(i,fig,scat):     ax.relim()     ax.autoscale_view()     scat.set_offsets(np.array([x[i],y[i]]))     return scat,  fig = plt.figure()  ax=fig.add_subplot(111,autoscale_on=true) ax.grid()  x=[x0] y=[y0] vx=[vx0] vy=[vy0] t in range(10000):     pv=getpv(x[-1],y[-1],vx[-1],vy[-1])     x.append(pv[0])     y.append(pv[1])     vx.append(pv[2])     vy.append(pv[3])  scat = plt.scatter(x=x0,y=y0,c=('r','b','r')) scat.set_alpha(0.8)  anim = animation.funcanimation(fig,_update_plot,fargs=(fig,scat),frames=10000,interval=100)  plt.show() 

relim seems reset limits tiny default limits of 0.05 -0.05. advice on how axes rescale appropriately each update appreciated.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -