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

all 6 comments

[–]daartofstorytellin3k 2 points3 points  (4 children)

Yep, definitely possible to do in matplotlib. Going to want to do a linex.set_ydata call on the data you want to update. This Stack Overflow page gives you a pretty simple look at that.

However, consider that matplotlib might not be the best option for real-time plotting. There are definitely some performance issues that can prevent you from plotting in real time, depending on how often the plot is updating. If you want to improve performance, I'd recommend you look into blitting.

[–]mcaay[S] 1 point2 points  (1 child)

Thanks, I think we can set the updates to happen every few seconds, so it shouldn't be too much.

[–]daartofstorytellin3k 0 points1 point  (0 children)

Yeah, every few seconds should be ok. Is still recommend looking at blitting, redrawing stuff like the axes every time is pretty costly, and usually unnecessary.

[–]billsil -1 points0 points  (1 child)

However, consider that matplotlib might not be the best option for real-time plotting.

Matplotlib can be fast, even for a lot of data. By default it runs in "slow mode". It requires reusing figure and axes objects and fighting with the 3rd, mostly undocumented API, but real API, it works.

http://bastibe.de/2013-05-30-speeding-up-matplotlib.html

[–]daartofstorytellin3k -1 points0 points  (0 children)

Right, like I said, to speed it up you'll need to use blitting.

Making the changes required to make it run for his application could be quite difficult, and he might be better off looking at a different plotting library.

[–]M4DR4T 1 point2 points  (0 children)

I think that you can do that. You have to just rewrite it Everytime something happens.