I am trying to use Mathematica to analyze some raw data. I would like to be able to dynamically display the range of data that interests me using Manipulate and ListLinePlot , but plot rendering is extremely slow. How can I speed it up?
Here are some additional details. An external text file stores raw data: the first column is a timestamp, the second, third and fourth columns are data, for example:
1309555993069, -2.369941, 6.129157, 6.823794 1309555993122, -2.260978, 6.170018, 7.014479 1309555993183, -2.070293, 6.129157, 6.823794 1309555993242, -1.988571, 6.238119, 7.123442
One data file contains up to 2 and middle, 10 6 lines. To display, for example, the second column, I use:
x = Import["path/to/datafile"]; ListLinePlot[x[[All, {1, 2}]]]
The execution time for this operation is unbearably long. To display a variable data range, I tried using Manipulate :
Manipulate[ListLinePlot[Take[x, numrows][[All, {1, 2}]]], {numrows, 1, Length[x]}]
This instruction works, but it scans quickly when I try to display more than a few thousand lines. How can I speed it up?
Additional information:
- MATLAB displays the same amount of data on one computer almost instantly, so raw data size should not be a problem.
- I already tried to disable graphical anti-aliasing, but this did not affect the rendering speed at all.
- Using
DataRange to avoid Take does not help. - Using
MaxPlotPoints distorts the chart too much to be useful. - Not using
Take in Manipulate does not help. - Rendering seems to take a huge amount of time. Doing
Timing[ListLinePlot[Take[x,100000][[All, {1, 2}]]]] returns 0.33 : this means that the Take score itself is almost instantaneous, it's a plot rendering that slows everything down. - I am running Mathematica on Ubuntu Linux 11.10 using fglrx drivers. Forcing Mathematica to use mesa drivers did not help.
Any clues?