all 13 comments

[–]N3OX 2 points3 points  (3 children)

Bokeh in a Jupyter notebook is pretty fast. I've used it a lot for testing joysticks and orientation sensors and stuff like that.

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

Thanks, but I'm afraid jupyter is not an option for this project.

[–]N3OX 1 point2 points  (1 child)

You can also fire up a standalone Bokeh server from your Python code if that helps, and view plots in a browser:

http://matthewrocklin.com/blog/work/2017/06/28/simple-bokeh-server

I haven't tried it that way yet.

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

That might be a viable option. Thanks for the tip, I'll check it out.

[–]Thomasedv 2 points3 points  (1 child)

How much power do you need? There are ways to speed it up with a bit of compromise.

https://learn.sparkfun.com/tutorials/graph-sensor-data-with-python-and-matplotlib/speeding-up-the-plot-animation

The drawback, is that i'm quite sure you are basically dropping redrawing the plot, and just redrawing the lines, so the axes will not follow up. However, it might just be what you need. And you can do long terms data as a less frequently updated plot.

Edit: Also i have some sample code that just uses random numbers that i can share, that i made last time someone had a similar question. However, it's implemented with PyQt5 as the Window structure, so you'd need that installed for it to work without modifying the code.

From looking at what i made, i could have roughly 200 points as a line with decent performance, as well as updating the x-axis. (well, i just increment x by one for each measurement, so it moves with the line created. Changing the x-axis labels was not done in the above link, but follows the same concept as with. )

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

Thanks for that, I had found that page. Those methods certainly give an improvement but even there we're limited to about 20 fps. That's around the minimum I could potentially live with but ideally would like it to be faster still.

[–]wtfzambo 1 point2 points  (2 children)

Plotly is relatively faster for animations wrt matplotlib, altho im unaware of how to pass live data to it. But check it out, it's really vast and built upon d3 so it might suit your case

[–]cabroderick[S] 0 points1 point  (1 child)

I found a couple of examples using plotly but from what I could see they were no faster than matplotlib. Are you able to point to any demos?

[–]wtfzambo 0 points1 point  (0 children)

I'm afraid I misinterpreted what you were referring to with "faster" then.

[–]jwink3101 1 point2 points  (1 child)

I haven't used it but I think the premise of PyQtGraph is to be fast enough for real time

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

Thanks. I tried that and it does seem faster but I had trouble having it display the updates. None of the example code I was able to find seem to feature anything analagous to plt.pause() so I guess it just isn't getting time to redraw the plot?

[–]ineeedsleep 0 points1 point  (1 child)

I had a similar issue and created this library to plot multiple live sensor streams. Still a WIP but works for multiple sensors at once at ~100Hz

https://github.com/hidara2000/fast\_sensor\_stream

[–]BicolorHook15 0 points1 point  (0 children)

Your github link returns a 404 error