Here is my gnuplot config file :
reset
set terminal png
set output "rp.png"
set title textcolor rgb "red" "R/P"
set yrange[0:110]
set xrange[0:110]
set xlabel "Rappel"
set ylabel "Précision"
set style data points
plot "test.dat" using 2:1 with linespoints
I would like to be able to replace at the last line "test.dat" by something like "filename" where "filename" would be passed.
For the moment I am just making this
FILE *gp;
if(WIN32)
{
cout<<"Win 32"<<endl;
gp=_popen("gnuplot", "w");
}
else
{
cout<<"pas win 32"<<endl;
gp=popen("gnuplot", "w");
}
if(gp == NULL)
{
fprintf(stderr, "Oops, I can't find %s.");
//exit(EXIT_FAILURE);
}
fprintf(gp, "load \"config\"\n");
fflush(gp);
pclose(gp);
but I have no idea on how to pass a parameter...
you could just set a variable containing the filename:
fprintf(gp, "filename=\"%s\";load \"config\"\n", file_name);
and then reuse it in your Gnuplot script:
reset
set terminal png
set output "rp.png"
set title textcolor rgb "red" "R/P"
set yrange[0:110]
set xrange[0:110]
set xlabel "Rappel"
set ylabel "Précision"
set style data points
plot filename using 2:1 with linespoints