|
From: Allan F. <all...@ya...> - 2012-02-22 23:42:24
|
> maybe the 'replot' command helps:
> for (i = 0; i< 30; i++) {
> x = (double) rand() / RAND_MAX;
> y = (double) rand() / RAND_MAX;
> if (i) {
> fprintf(pipe,
> "replot '< echo %lf, %lf' w p pt 7 lc -1 notitle \n",
> 4*x, 4*y);
> } else {
> fprintf(pipe,
> "plot '< echo %lf, %lf' w p pt 7 lc -1 notitle \n",
> 4*x, 4*y);
> }
> fflush(pipe);
> usleep(150000);
> }
Yes, that solution also works ! However I tested it and it's really slow.
Saving the data to a file and reading it is faster, like:
--------------------------------------------------------------------------------------------------------------
FILE *output;
output = fopen("data.txt", "w");
for (i = 1; i <= MAX; i++) {
x = (double) rand() / RAND_MAX;
y = (double) rand() / RAND_MAX;
fprintf(output, "%lf %lf \n", x, y);
}
fclose(output);
for (i = 1; i <= MAX; i++) {
fprintf(pipe, "plot 'data.txt' every ::1::%d using ($1*4):($2*4) pt
7 lc -1 notitle \n", i);
fflush(pipe);
usleep(1000);
}
-----------------------------------------------------------------------------------------------------------
Then, so far, I guess that's an acceptable way of using the C environment
for making animations. And if I need some extra flexibility I could save
each image and merge them with ffmpeg.
About the mailing list, I'm sending the messages through Nabble forum and I
keep receiving : Your recent message has not yet been accepted by the
mailing list and is still in the pending status. So I think it is weird that
I'm getting answers, and the mailing list actually receives my messages.
--
View this message in context: http://old.nabble.com/Plot-one-additional-point%2C-manually-tp33350361p33374457.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|