0

I have this piece of code

int draw_cell_bary(char *filename, char *filenameOutput, int format){

char buff[500];
FILE *f;

char draw_name_file_pattern[] = "%s%s%s%s%s";
f = popen("gnuplot", "w");
//sprintf(buff, draw_name_file_pattern ,"plot '",filename,"' with lines,' \n set term postscript\n set output \"",filenameOutput,"\"\n replot\n");
switch(format){
    case 1:
        sprintf(buff, draw_name_file_pattern ,"plot '",filename,"' \n set terminal png\n set output \"",filenameOutput,"\"\n replot\n");
        break;

        sprintf(buff, draw_name_file_pattern ,"plot '",filename,"' \n set term postscript\n set output \"",filenameOutput,"\"\n replot\n");
    case 2:
        break;

}
fprintf(f,"%s", buff);
fflush(f);
pclose(f);

return 1;
}

This code works fine but when I use it to create a drawing, the window appears in a popup and is immediatly closed. I want that the window from gnuplot stays hidden and that the output is created without the user to see it.

I've found --noraise but I'm not sure if that's what I want.

Thanks

4

1 回答 1

0

plot命令首先出现在您发送给 gnuplot 的命令中——因为默认终端没有更改,所以 gnuplot 会绘制到屏幕上,然后消失。

如果你plot在你之后移动命令set terminal ...; set output,那么窗口将不会出现,你也不需要该replot命令。

于 2013-07-16T13:08:05.040 回答