|
From: gbliu <goo...@gm...> - 2011-11-18 09:43:55
|
Dear all:
These years gnuplot becomes more and more powerful. In sense, it's a
quasi-programming-language. String variable is supported since ver4.0, and {}
blocks and loops are supported in ver4.5. But a basic function, array, is still
not supported now. I think this is highly needed, especially when loops are
supported.
------------------------
e.g.
I have a data file with many columns, but want to plot only some columns, say,
column 2, 3,6,7,9,15,24. And the lengeds for each column differ. Now, I can only
use the command as follow:
plot 'data' u 1:2 title '...', '' u 1:3 title '...', '' u 1:6 title '...',\
'' u 1:7 title '...', '' u 1:9 title '...', '' u 1:15 title '...',\
'' u 1:24 title '...'
Although gnuplot support "plot for [i=...]" now, but it cannot be used here,
because the column numbers is not regular. In this case, array is needed to
simplify the plot command.
Suppose there are two arrays, col and str:
col[1]=2; str[1]='...'
col[2]=3; str[2]='...'
col[3]=6; str[3]='...'
col[4]=7; str[4]='...'
col[5]=9; str[5]='...'
col[6]=15; str[6]='...'
col[7]=24; str[7]='...'
now, I can use the following more concise command:
plot for [i=1:7] 'data' u 1:(column(col[i])) title str[i]
------------------------
Therefore, array is highly suggested to be supportted by gnuplot!
Yours, faithfully
gbliu
|