Gnuplot C++ plotting in real time from txt files -
hi plotting data file through pipe in c++. have written function reads in text file, processes information, plots data in text file , plots labels , arrows needed.
now need way plot smoothly in loop, different text file read , plotted every iteration without gnuplot window flickering.
for example:
for (unsigned int = 0; i< 10; i++){ processing_plotting(i, gp); }
this code have in main program plot text file indicated 'i'. eg: laserdata1, laserdata2 etc..
currently plot flickers , unreadable due speed called. have looked way plot data in real time gnuplot haven't had luck, appreciated. thanks
a picture of sort of thing plotting: http://imgur.com/3etpmab
there example of animation comes gnuplot-iostream library. doesn't flicker, @ least not on machine (linux). disclaimer: i'm author of library, shameless plug.
your code snippet doesn't show how interface gnuplot, there 3 things must sure do: 1) don't close , reopen pipe after each frame, 2) call fflush
on pipe after every frame, , 3) add delay between frames. delay on linux call ::usleep(microseconds)
(and include unistd.h
), on windows call ::sleep(milliseconds)
, include windows.h
.
the thing piping animation data gnuplot don't know if keeping up. flush , sleep vital. have built oscilloscope out of gnuplot know can work well.
Comments
Post a Comment