I have a set of x and y values that I fit onto a polynomial using the gsl_multifit_linear function. I would like to plot the best-fit curve onto the scatterplot using gnuplot. Right now, I only figured out how to plot the points themselves:
FILE *gnuplot = popen("gnuplot", "w");
fprintf(gnuplot, "plot '-'\n");
for (int i = 0; i < num_points; i++)
fprintf(gnuplot, "%g %g\n", xvals[i], yvals[i]);
printf(gnuplot, "e\n");
fflush(gnuplot);