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


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

problem piping commands to gnuplot under Windows

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From John Edwards <johned0@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject problem piping commands to gnuplot under Windows
Date Sun, 12 Jan 2014 00:19:16 +0000
Lines 47
Message-ID <bje5c6F7tvaU1@mid.individual.net> (permalink)
Reply-To johned0@gmail.com
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net BIeWz5Eo3v2ddy2/QjknUwX6wH8oh9183ePHADBpx7XDCR+ztO
Cancel-Lock sha1:amEZdsmWS9Eb4Qb7YnBFuD6DQg4=
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
Xref csiph.com comp.graphics.apps.gnuplot:2252

Show key headers only | View raw


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 | NextNext 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