python - make matplotlib draw() only show new point -


so have 3d graph scatterplot updating point going through dataframe. have add new point ever .1 seconds. here code:

ion() fig = figure() ax = fig.add_subplot(111, projection='3d') count = 0 plotting = true while plotting:     df2 = df.ix[count]     count += 1     xs = df2['x.mean']     ys = df2['y.mean']     zs = df2['z.mean']     t = df2['time']     ax.scatter(xs, ys, zs)     ax.set_xlabel('x label')     ax.set_ylabel('y label')     ax.set_zlabel('z label')     ax.set_title(t)     draw()     pause(0.01)     if count > 50:         plotting = false ioff() show() 

how can show new point on live-updated graph. right starts 1 point , adds , until there total of 50 points on graph.

so want there never more 1 point on graph , have point changing iterates through. how can this?

ion() fig = figure() ax = fig.add_subplot(111, projection='3d') count = 0 plotting = true # doesn't need in loop ax.set_xlabel('x label') ax.set_ylabel('y label') ax.set_zlabel('z label')  lin = none while plotting:     df2 = df.ix[count]     count += 1     xs = df2['x.mean']     ys = df2['y.mean']     zs = df2['z.mean']     t = df2['time']     if lin not none:         lin.remove()     lin = ax.scatter(xs, ys, zs)     ax.set_title(t)     draw()     pause(0.01)     if count > 50:         plotting = false ioff() show() 

in principle can use normal plot instead of scatter , update data in loop, 3d updating can wonky/may require poking @ internals bit.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -