Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2253

Re: problem piping commands to gnuplot under Windows

From John Edwards <johned0@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: problem piping commands to gnuplot under Windows
Date 2014-01-12 08:17 +0000
Message-ID <bjf1ciFd0kqU1@mid.individual.net> (permalink)
References <bje5c6F7tvaU1@mid.individual.net>

Show all headers | View raw


I had a bit of a lightbulb moment while waking up this morning and 
wondered if it was a CR/LF problem and sure enough the following code 
works fine :

fprintf (gnuplotPipe, "plot \"1.tmp\" using 1:2 title \"Data set 0\" 
with lines lc rgb \"purple\", \\\r");

Note the \r rather than \n.
Does anyone think this should be reported as a bug ?
Cheers,
John


On 12/01/2014 00:19, John Edwards wrote:
> 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 | NextPrevious in thread | Find similar


Thread

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