Reputation: 5645
I have 10GB file with a couple of billions entries. It has many columns. I want to plot each column into different subplot. I used the following MWE:
set datafile separator ","
set terminal png
set output "a.png"
set multiplot layout 2,1 title ""
plot "camkii.dat" using 1:2 with lines
plot "camkii.dat" using 1:23 with lines
This script takes few tens of seconds. As you can see, I call plot "camkii.dat" ...
two times. I suspect that the file is read each time. This is not very efficient and I might run out of memory.
If I could read the file into some variable (say foo
) and then plot each subplot using the variable foo. Something similar to plot foo[1] ...
and plot foo[2] ...
etc. That way I read the file only once.
Am I right in suspecting the gnuplot might be loading the file two times. If yes, will saving the file into a variable and plotting it will help? Changes suggested to MWE would be great.
Upvotes: 3
Views: 539
Reputation: 27373
I guess the entire file is read tice, but i'm not sure. If you are on a Linux system, you could invoke awk
to extract the needed columns (but the first column is again read twice)
plot "<awk '{print $1 $2}' camkii.dat" with lines
plot "<awk '{print $1 $23}' camkii.dat" with lines
Upvotes: 1