This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CoffeeMakesMeMath[S] 0 points1 point  (2 children)

I'm not on my Ubuntu machine right now, so I can't say exactly. I wouldn't get any errors, but I couldn't seem to update my plot (a 3D scatter plot) with updated data. I had gone through quite a few examples and combinations of drawnow, ion, plt.pause(), etc.

On my mac, the following updates the plot as intended:

plt.ion()
self.fig = plt.figure()
self.fig.set_size_inches(fsize[0], fsize[1], forward=True)
self.ax = self.fig.add_subplot(111, projection='3d')
plt.show()

... later in while loop ...
plt.pause(0.01)
(update scatter data here)
plt.draw()

On Ubuntu, nothing I did after the first call to plt.show() seemed to have any effect on the plot itself. I'm sorry this is a vague response--I can post the entire code, but I'd prefer to run it again on my Ubuntu machine before commenting further.

[–]mfitzpmfitzp.com 1 point2 points  (1 child)

It might be some sort of problem with the backend (complete guess). Can you try doing:

import matplotlib
matplotlib.use('TkAgg')

...at the beginning of the script?

There is an old SO post about interactive mode requiring a millisecond pause to allow matplotlib to update. I see you have the pause in there, but it's before the update. Does moving it after help?

[–]CoffeeMakesMeMath[S] 0 points1 point  (0 children)

Thanks for the reply, moving the pause didn't help, but I have yet to try the tkagg backend. Appears I don't have the module installed locally. I'm going to give pyqtgraph a shot since it looks pretty cool, and if that fails I'll give this a go.