I'm using Windows 2000, and I've gotten good results except I can't get
a parametric plot to display with a set of data points. I'm using C,
inspired by pdemo.c. First, here's what works:
gnuplot = _popen("pgnuplot.exe", "wb")
setbuf( gnuplot, NULL );
fprintf(gnuplot, "set title 'Best Trajectory So Far'\n");
fprintf(gnuplot, "set size ratio -1\n"); /* for round circles */
fprintf(gnuplot, "plot '-',"); /* so gnuplot accepts piped
input */
fprintf(gnuplot, "sqrt(10000.0-x*x), -sqrt(10000.0-x*x)\n"); /*
parametric is better */
for(i=0; i<count; i++)
fprintf(gnuplot, "%8.2f %8.2f\n",point[i].x, point[i].y);
/* pipe the data */
fprintf(gnuplot,"e\n"); /* gnuplot needs this EOD signal */
That works fine. The line with the 2 sqrt()s draws 2 circle arcs, so
the result is a circle and a series of points. That's what I want,
except the circle has gaps and is of two colors. I would prefer a
parametric plot, but when I replace that line with the following it does
not draw anything:
fprintf(gnuplot, "set parametric\n");
fprintf(gnuplot, "[-pi:pi] 100*sin(t), 100*cos(t)\n");
fprintf(gnuplot, "unset parametric\n");
So, how can my C program draw a parametric plot followed by a bunch of
points?
Thanks,
Mitchell Timin
--
"In theory, there is no difference between theory and practice. In
practice, there is."
http://annevolve.sourceforge.net is for those seeking something to do
with their wetware.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.7 - Release Date: 5/9/2005
|