-
Notifications
You must be signed in to change notification settings - Fork 102
Description
Hello,
I've been trying to use gnuplot-iostream for live plotting Arduino data as it is read using my c++ program. I'm finding that it produces some unknown errors and the time it takes to plot can be very inconsistent.
Currently my code looks like this:
std::vector<std::vector<float>> data;
Gnuplot gp;
While (true)
{
/*
Bunch of code here to fill data variable with Arduino measurements
over the last ~5 seconds with 200ms cadence, col 1 is times, col 2 is the data.
There are more cols but I'm ignoring them for now
*/
gp << "plot '-' using 1:2 with points notitle\n"
gp.send1d(data)
}
This gives me errors such as
Gnuplot> 0
^ line 110: invalid command
I've tried a number of things, and the only thing that gets this invalid command error to go away is by having three \n at the end of the plot command.
In any of these cases the plotting command will either be instant or take up to a full second and is seemingly random.
Could you provide an example for having an updating plot that either gets rid of this errors or normalizes the plotting speed, or both? Ideally it would not use the pause command as that also interrupts the reading of data from the arduinos.
Thanks