I've been wanting to plot some data with gnuplot. What I've written compiles fine, and also executes. The plot itself even seems to work in gnuplot.
However, I'm getting an warning that I want to understand:
Warning: slow font initializationqt_processTermEvent received a GE_fontprops event. This should not have happened
What does this error mean, and how can I avoid it? Does this even have any effect on the plot?
I've included my code below, which is a crude population simulation to see chaotic behavior.
#include <stdio.h>
int main(int argc, char const *argv[]) {
float currentPop;
float nextPop = 0;
float growthRate;
FILE *fp = NULL;
FILE *gnupipe = NULL;
char *GnuCommands [] = {"set title \"Popsim\"", "plot 'data.tmp'"};
fp = fopen("data.tmp", "w");
gnupipe = _popen("gnuplot -persistent", "w");
printf("Enter current population and growth rate:\n");
scanf("%f %f", ¤tPop, &growthRate);
for (int counter = 0; counter < 30; counter++) {
nextPop = growthRate * currentPop * (1 - currentPop);
fprintf(fp, "%d %f\n", counter, nextPop);
currentPop = nextPop;
}
for (int i = 0; i < 2; i++) {
fprintf(gnupipe, "%s\n", GnuCommands[i]);
}
return 0;
}
Also, a bonus question: How do I make gnuplot draw a line between the points it plots, so that it's easier for me to visualise?
plot 'data.tmp' with linesorplot 'data.tmp' with linespoints?wxtterminalset term wxt. Maybe you will find some more explanations (in the future) here: sourceforge.net/p/gnuplot/bugs/2316fclose(fp);before sending commands through the pipe (or even before opening the pipe).