Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. def data_gen(): #Data generator. Gives me the anchor.
  2. counter = 0
  3. x0 = data_gen.x0
  4. while counter < 1000:
  5. counter+=1
  6. x0-=0.09
  7. yield x0,(1-counter*0.05)
  8. data_gen.x0=1
  9.  
  10. def animate_text(data): #Here is where I try to tell my code to refresh
  11. #only the coordinates of the text.
  12. x0,y0 = data
  13. text_sample = ax.text(x0,y0,'text here',transform=ax.transAxes,
  14. fontsize=12, color='black',fontstyle='oblique',family='serif')
  15. return text_sample
  16.  
  17. #animation part:
  18.  
  19. ani = animation.FuncAnimation(fig,animate_text,data_gen,blit=True,
  20. interval=50,repeat = False)
  21. plt.show()
  22.  
  23. File "C:Python27libsite-packagesmatplotlibanimation.py", line 1777,
  24. in _draw_frame
  25. for a in self._drawn_artists:
  26. TypeError: 'Text' object is not iterable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement