I'm trying to plot using Gnuplot in C and so far I'm half succeeding following another thread, but couldn't find anywhere how to go one step beyond.
My code for plotting goes as follows:
char * commandsForGnuplot[] = {"set title \"Probability evolution\"", "plot 'data.temp' with linespoints", "set xlabel \"beta probability\"", "set ylabel \"Fraction of sick individuals\""};
FILE * temp = fopen("data.temp", "w");
FILE * gnuplotPipe = popen ("gnuplot -persistent", "w");
for (i=0; i < NB; i++){
fprintf(temp, "%lf \n", B[i]);
}
for (i=0; i < 4; i++){
fprintf(gnuplotPipe, "%s \n", commandsForGnuplot[i]);
}
Everything is showed correctly except for the xlabel and ylabel, so this part must be wrong:
"set xlabel \"beta probability\"", "set ylabel \"Fraction of sick individuals\""
Does anyone know how to set it properly?
Also, how can I set the size of these labels and the title?
Thanks a million!