5

I'm trying to find a tool for plotting data (mostly line graphs and such) that can be used for high performance applications. My data window typically contains between 500 to several thousand points, and I'd be happy with a framerate of 10 or so. I receive my data as a binary stream on a socket. I am on Mac OS X.

I've tried several solutions, and I discuss my experiences with them below.

R: Dreadfully slow and unable to keep up, painful to read sockets, graph flickers.

matplotlib: Pretty slow but a little usable, also. However, it requires a ton of Python machinery to run, and IMO the API is pretty opaque. Under constant updating, the window containing the graph becomes modal and the Mac beachball appears -- not great for user interaction.

Gnuplot: Much better performance and API. However, communicating large quantities of data to gnuplot happens by generating temporary ASCII (!) files -- this means if my framerate goes up, I'm starting to do tons of disk reads and this is a performance issue.

Any other suggestions?

Jake
  • 14,329
  • 20
  • 64
  • 85
  • your question seems similar to mine: http://stackoverflow.com/questions/8946474/is-it-possible-to-speed-up-matlab-plotting-by-calling-c-c-code-in-matlab – memyself Feb 06 '12 at 17:04
  • I'm not sure if you can do this outside of C++ or other language, but I prevent flicker by painting to a memory bitmap and then blitting it to the screen. This is actually faster because it's not clipping to overlapping rectangles during the paint. Also, to the user it looks fast even if it's not. – Mike Dunlavey Feb 06 '12 at 17:35
  • @MikeDunlavey Thanks -- but what technologies do you use to do the plotting and painting. – Jake Feb 06 '12 at 20:03
  • Well, as I said, I work within C++ or C. I'm sure you can do the same in Java, etc. You have a window and Paint handler for it, as in Win32 and MFC. It sounds like you're working at less of a programmer's level. I imagine it could be done in R or whatever, but it would take some digging in the doc. – Mike Dunlavey Feb 06 '12 at 20:30

3 Answers3

6

Try gnuplot using piped data rather than temporary files. Example usage:

plot "data_acquisition_cmd <" with image

You can pipe in an endless stream of replots by reading commands from a pipe as well:

load "while [ 1 ]; do echo 'replot'; done <"

For a more robust solution, consider using an interface to gnuplot from Perl, like GnuplotIF, or Python (gnuplot.py), since they permit both programmatic control of gnuplot and the ability to pass data directly to it.

Edit: Thanks Jonhoo for the syntax correction

Phil H
  • 18,593
  • 6
  • 62
  • 99
0

You can consider writing your own data visualization program in Qt by using QCustomPlot http://www.workslikeclockwork.com/index.php/components/qt-plotting-widget/

It's able to display realtime data and has a very good output quality, I've used it in the past for a similar project.

linello
  • 7,476
  • 14
  • 53
  • 98
0

The Qwt library has a the ability to plot data in real time. There are even couple of examples in the source tree that provide different ways of plotting in real time. Notably, I'd suggest looking at oscilloscope, refreshtest and realtime examples.

Additionally, there has also been a recent discussion on the mailing list that might be helpful.

John Cummings
  • 1,450
  • 3
  • 17
  • 29