While this is a trivial task in MATLAB or LabVIEW, I wondered if there was a low effort way to do it for free.
![]() Python Serial Port Example Windows Product Update A GraphAs it turns out, Matplotlib includes an animation API and a function called FuncAnimation, which can be used to animate data over time (or update a graph with some sensor data over time).For a proper introduction to Matplotlib, Id recommend sentdexs Matplotlib video series.In the example code below, the arduino simulates a coin toss using the function random.
Python Serial Port Example Windows Product Serial Port AsThis data is then sent to the serial port as comma delimitted line, where the termination character is n. I have composed very similar code; however, I noticed that over time (after about 3 hours), the figure starts to lag, and I start to get the not responding message at the top of the figure. Unfortunately, I would prefer this figure to run for about a week, so you can imagine my frustration when I saw it start to lag before the end of the first day. ![]() From your comment, I wonder if the lag issue youre seeing is a buffer issue One approach might be to plot only the last 100 points or so. ![]() But im able to plot just one coordinate (y-axis) over the trials i (x-axis). But i want to Plot the x-Values to the x-axis and the y-values to the y-axis.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |