I'm using a raspberry pi currently for a engineering project, and am collecting data using the GPIO pins from various sensors. Id like to display this data on a graph. I've used matplotlib to get a graph to show, but for the program to continue you need to close the graph window. I've researched, but can't seem to find a way to make the graph stay open, and have it continually updated with the program running in the background. Is there a way to do this? Or should I try creating a HTML file with a graph in it and have the program open that? Thanks for any help!
2 Answers
You can use the Plotly Python API to log and stream data to a graph in your browser from your RasPi. You can fork the code from GitHub to setup an online graph like this. The example here is temperature.
Once you've generated your graph, you can embed it as an iframe with this snippet:
<iframe id="igraph" src="https://plot.ly/~abhishek.mitra.963/1/400/250/"
width="400" height="250" seamless="seamless" scrolling="no"></iframe>
You'll want to swap in your URL in the snippet. You can edit the width and height in the URL string and fields to change how it looks. Here's how it looks:

(Full disclosure: I'm on team Plotly).