i am using gnuplot-iostream to plot datapoints.
So, I have two sets. I can successfully plot the first set, but it fails at the second set.
first_pts = {....};
second_pts = {....};
Gnuplot gp2d;
gp2d << "set xrange [-5:5]\n";
gp2d << "set yrange [-5:5]\n";
for ( auto i = 0 ; i < 2 ; i ++ ) {
if ( i == 0 )
gp2d << "plot '-' with points title 'first'\n";
gp2d.send1d(first_pts);
else
gp2d << "replot\n";
gp2d.send1d(second_pts);
}
I deliberatly do not want the data to be plotted in one iteration, because that wont work in my real environment. Replot is ofcourse wrong here, and hence the question - whats the right way?
Ok, I figured it out. Just add another input to gnuplot plot command and gnuplot will wait for the second point before plotting.