Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2252
| From | John Edwards <johned0@gmail.com> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | problem piping commands to gnuplot under Windows |
| Date | 2014-01-12 00:19 +0000 |
| Message-ID | <bje5c6F7tvaU1@mid.individual.net> (permalink) |
Hello again folks,
I am trying to plot two data files using the following code :
#include <stdlib.h>
#include <stdio.h>
void main()
{
FILE * gnuplotPipe = _popen ("gnuplot -persist", "w");
FILE * f1 = fopen("1.tmp", "w");
FILE * f2 = fopen("2.tmp", "w");
int i;
for (i = 0; i < 5; i++)
{
fprintf (f1, "%lf %lf\n", (float)i, (float)i);
fprintf (f2, "%lf %lf\n", (float)i, (float)i+1);
}
fclose (f1); fclose (f2);
fprintf (gnuplotPipe, "plot \"1.tmp\" using 1:2 title \"Data set 0\"
with lines lc rgb \"purple\", \\\n");
fprintf (gnuplotPipe, " \"2.tmp\" using 1:2 title \"Data set 1\" with
lines lc rgb \"green\"\n");
fflush (gnuplotPipe);
getchar ();
fprintf (gnuplotPipe, "exit\n");
_pclose (gnuplotPipe);
}
This works fine if I run the plot command in gnuplot from a script or if
I use pgnuplot but when I use gnuplot I get the following error message :
gnuplot> plot "1.tmp" using 1:2 title "Data set 0" with lines lc rgb
"purple", \
>
gnuplot> '2.tmp' using 1:2 title "Data set 1" with lines lc rgb "green"
^
invalid command
Can anyone tell me if I am being a numpty ?
Thanks very much,
John
Back to comp.graphics.apps.gnuplot | Previous | Next — Next in thread | Find similar
problem piping commands to gnuplot under Windows John Edwards <johned0@gmail.com> - 2014-01-12 00:19 +0000 Re: problem piping commands to gnuplot under Windows John Edwards <johned0@gmail.com> - 2014-01-12 08:17 +0000
csiph-web