使用gnuplot iostream在最后一个绘图上再次绘图

使用gnuplot iostream在最后一个绘图上再次绘图,gnuplot,gnuplot-iostream,Gnuplot,Gnuplot Iostream,我正在使用gnuplotiostream绘制数据点 所以,我有两套。我可以成功地绘制第一组,但第二组失败 first_pts = {....}; second_pts = {....}; Gnuplot gp2d; gp2d << "set xrange [-5:5]\n"; gp2d << "set yrange [-5:5]\n";

我正在使用gnuplotiostream绘制数据点

所以,我有两套。我可以成功地绘制第一组,但第二组失败

             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);
                 }
first_pts={……};
第二部分={……};
gnuplotgp2d;

gp2d好的,我知道了。只需将另一个输入添加到gnuplot plot命令,gnuplot将在打印前等待第二个点

         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', '-' with points title 'second'\n";
               gp2d.send1d(first_pts);
             else    
               //gp2d << "replot\n";
               gp2d.send1d(second_pts);
             }
first_pts={……};
第二部分={……};
gnuplotgp2d;
gp2d