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


Groups > comp.graphics.apps.gnuplot > #3701 > unrolled thread

Run gnoplot from code::Blocks in Windows10

Started byugo.m.mela@gmail.com
First post2017-07-28 02:20 -0700
Last post2017-07-29 06:58 -0700
Articles 4 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Run gnoplot from code::Blocks in Windows10 ugo.m.mela@gmail.com - 2017-07-28 02:20 -0700
    Re: Run gnoplot from code::Blocks in Windows10 Gavin Buxton <gavinbuxton@gmail.com> - 2017-07-28 09:56 -0700
      Re: Run gnoplot from code::Blocks in Windows10 John Edwards <johned0@gmail.com> - 2017-07-29 23:16 +0100
    Re: Run gnoplot from code::Blocks in Windows10 Gavin Buxton <gavinbuxton@gmail.com> - 2017-07-29 06:58 -0700

#3701 — Run gnoplot from code::Blocks in Windows10

Fromugo.m.mela@gmail.com
Date2017-07-28 02:20 -0700
SubjectRun gnoplot from code::Blocks in Windows10
Message-ID<e7b1987b-e6e4-4b7d-848a-7d9ce1de79d4@googlegroups.com>
Hi,

I have to plot a 3D function, which is the result of a c++ program, with gnuplot. In the same time I have to evaluate the evolution over time of the function, so I have to plot the output that the c++ program give me, each second on the same graph.

I think that I could use the ShellExecute() and I wrote this code:

ShellExecute(NULL, "open", "C:\\Programmi\\gnuplot\\bin\\gnuplot.exe", "plot sin(x) pause-1", NULL, SW_SHOW);

The problems are related to the facts that:

1- The execution of the program is too fast and I don't see anything.
2- I don't know how pass an array of float numbers to gnuplot with the previous function.
3- I can't replace the plot over the previous one in order to evaluate the evolution over time.

How can I solve?

Thanks!

[toc] | [next] | [standalone]


#3702

FromGavin Buxton <gavinbuxton@gmail.com>
Date2017-07-28 09:56 -0700
Message-ID<d1ea5f48-6469-475e-a1be-7535b4239713@googlegroups.com>
In reply to#3701
Hi

I use linux, and have no idea what windows does, but this works for me:

fp = popen("gnuplot", "w");

where fp is defined previously by

FILE *fp;

then whenever I want to pipe commands to gnuplot I just

fprintf(fp, "plot 'file.dat'");

which, for example, would plot the file 'file.dat', that could be written to in your code. Every second for 3D data could be laggy, but it depends on your computer and the data size I guess.


Gavin

[toc] | [prev] | [next] | [standalone]


#3704

FromJohn Edwards <johned0@gmail.com>
Date2017-07-29 23:16 +0100
Message-ID<eu4fpaF63sU1@mid.individual.net>
In reply to#3702
Gavin is correct, pipes are the way to go.
I haven't used code::Blocks but I have used wxWidgets and for plotting I 
wrote a C/C++ wrapper library that does the job : 
https://sourceforge.net/projects/gnuplotc/.
John


On 28/07/2017 17:56, Gavin Buxton wrote:
> Hi
> 
> I use linux, and have no idea what windows does, but this works for me:
> 
> fp = popen("gnuplot", "w");
> 
> where fp is defined previously by
> 
> FILE *fp;
> 
> then whenever I want to pipe commands to gnuplot I just
> 
> fprintf(fp, "plot 'file.dat'");
> 
> which, for example, would plot the file 'file.dat', that could be written to in your code. Every second for 3D data could be laggy, but it depends on your computer and the data size I guess.
> 
> 
> Gavin
> 

[toc] | [prev] | [next] | [standalone]


#3703

FromGavin Buxton <gavinbuxton@gmail.com>
Date2017-07-29 06:58 -0700
Message-ID<4f51dc71-9b22-487e-b17f-2002f6fcfe4d@googlegroups.com>
In reply to#3701
I may have misunderstood your previous post as being you wanted to plot your data in real time. If thats not the case then you can run a script with 

plot 'data1.dat'
pause 1
plot 'data2.dat'
pause 1
.
.
.

You don't have to reopen gnuplot for each plot, and if you want to add to previous plots, then for the 2nd plot onwards use "replot" instead of "plot" in the above.


Gavin 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web