python - Can't show animation for bar graph in Matplotlib -
i have text file updating single value. i'm trying display value using matplotlib's animation i'm having lots of issues. example want show value that's changing every second on text file (value ranges 0 150) , want height of bar graph increase , decrease value.
i want same horizontal graph. want show dot moving around circle different values (between 0 , 360).
i've tried many things broke code or matplotlib froze. i've been trying use matplotlib's animation.
any appreciated. when run code don't see bar graph
import matplotlib.pyplot plt import mpl_toolkits.mplot3d.axes3d p3 import matplotlib.animation animation import random mf = r"data.txt" fig = plt.figure() ax = p3.axes3d(fig) xpos = 0 ypos = 0 zpos = 0 dx = 1 dy = 1 def update_bars(): mmf = open(mf) lines = mmf.readlines() depth_1 = lines[3] dz = depth_1 bars = ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color= 'b') return bars ## add bars ax.set_title('depth') line_ani = animation.funcanimation(fig, update_bars, 500, interval=100) plt.show()
just had change depth_1 = lines[3] depth_1 = int(lines[3])
Comments
Post a Comment