I am trying to update plot every iteration. I got a great answer here and shown below:
self.point, = plt.plot([],[], 'o', color='green')
self.line, = plt.plot([],[], ls="-", color='red', lw=2)
plt.show(block=False)
self.plot_pose()
def plot_pose(self):
self.point.set_data(self.pose[0], self.pose[1])
self.line.set_data([self.pose[0], self.pose[0] - 0.5*np.cos(self.pose[2])],
[self.pose[1], self.pose[1] + 0.5*np.sin(self.pose[2])])
plt.pause(0.0001)
Unfortunately, when I run this on jupyter notebook, it doesn't update the plot, even with the %matplotlib inline
.
Any suggestions on how to get this to work on jupyter-notebook?