|
From: Allan F. <all...@ya...> - 2012-02-19 01:56:24
|
Hi, I would like to plot a set of points which is being generated by a C
code, using pipe. It would plot a sequence of these points making a video.
Here is an example that does the job:
----------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
FILE *pipe;
pipe = popen("gnuplot -persist", "w");
fprintf(pipe, "set xlabel 'x (m)' \n");
fprintf(pipe, "set ylabel 'y (m)' \n");
fprintf(pipe, "set pointsize 1 \n");
fprintf(pipe, "set xrange[-0.1:4.1] \n");
fprintf(pipe, "set yrange[-0.1:4.1] \n");
int i;
double x, y;
for (i = 1; i < 30; i++) {
x = (double) rand() / RAND_MAX;
y = (double) rand() / RAND_MAX;
fprintf(pipe, "plot '< echo %lf, %lf' w p pt 7 lc -1 notitle \n",
4*x, 4*y);
fflush(pipe);
usleep(150000);
}
fclose(pipe);
return 0;
}
-------------------------------------------------------------------------------------
It works ... however, the way it is done, it plots just one point at a time.
I would like to plot one point, then another one, but keeping the last point
... then another, keeping all the other 2 ... so I'd like to know how I
could add one point to a graph that is already done, that would solve my
problem.
--
View this message in context: http://old.nabble.com/Plot-one-additional-point%2C-manually-tp33350361p33350361.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|