2
votes

I'm making a chart but I would like to use lines rather than points.

Using the style of lines, all the points are connected and the graph has a network appearance, which I don't want.

set grid 
set ticslevel 0.1 
set samples 51, 51 
set isosamples 20, 20 
set border 1+2+4+8
unset key
splot 'matrix.dat' matrix

part of data to matrix plot

0.261   0.665   0.225   0.382   0.255   0.574   0.356
0.338   0.845   0.0363  0.167   0.727   0.0805  0.764
0.225   0.196   0.107   0.153   0.347   0.338   0.168
0.157   0.443   0.0671  0.135   0.312   0.408   0.362
0.151   0.281   0.0572  0.103   0.309   0.49    0.242
0.12    0.336   0.0604  0.173   0.19    0.395   0.153
0.119   0.173   0.0336  0.145   0.156   0.219   0.177
0.123   0.0452  0.0165  0.149   0.0932  0.0663  0.133
0.123   0.0741  0.00373 0.136   0.0346  0.485   0.131
0.111   0.241   0.0124  0.105   0.0127  1.01    0.122
0.096   0.475   0.0194  0.0569  0.0284  1.67    0.102
0.0777  0.773   0.0175  0.00929 0.0375  2.42    0.0831
0.059   1.11    0.0123  0.0322  0.0408  3.23    0.0635
0.0438  1.48    6.44E-4 0.0659  0.0265  4.07    0.0445
0.0349  1.92    0.0192  0.078   0.00585 4.92    0.0254
0.0392  2.42    0.0446  0.0632  0.0306  5.73    0.00774
0.0518  2.97    0.0745  0.031   0.0729  6.46    0.00716

Model Graphics

2
what exact plot command are you using? what code have you written? do you want a line plot instead of points? - Zahaib Akhtar
@Zahaib I believe that the OP would like to use lines but when he does so, they are all joined together. If that is the case, the solution would be to put blank lines between the series in the input file. I agree, some code and some sample data would be useful. - Tom Fenech
@TomFenech, indeed, that seemed to be my first impression as well, but hard to give any concrete suggestions without looking at the code and data file. Also to make it more useful for somebody later. - Zahaib Akhtar
I used splot 'matrix.dat' matrix @ZahaibAkhtar - Fabio Lima
I agree with you but the matrix is only a fraction would have thought much points. If you need I'll be sending the attachment.- @TomFenech - Fabio Lima

2 Answers

2
votes

This cannot be done automatically. You must determine the rows and columns of your matrix. First, to get the number of rows, use

stats 'matrix.dat' using 1 nooutput
rows = STATS_records

For the number of columns, use then

stats 'matrix.dat' matrix nooutput
cols = STATS_records/rows

And now plot every line

unset key
splot for [i=0:cols-1] 'matrix.dat' matrix every ::i::i lt 1 with lines

Result (with 4.6.4) is:

enter image description here

0
votes

I think Christoph's solution is just what you need, but to make the point clear, by providing the matrix and using splot matrix alone will just generate a mesh.

So you will need to specify the lines with complete X, Y and Z vectors and then plot them using splot with lines/linespoints. I'm adding an example below in case it may be helpful for anyone else.

You arrange your data file as follows: 10 1 0.261 2 0.665 3 0.225 4 0.382 5 0.255 6 0.574 7 0.356 20 1 0.338 2 0.845 3 0.0363 4 0.167 5 0.727 6 0.0805 7 0.764 30 1 0.225 2 0.196 3 0.107 4 0.153 5 0.347 6 0.338 7 0.168 40 1 0.157 2 0.443 3 0.0671 4 0.135 5 0.312 6 0.408 7 0.362

And then plot as follows:

set grid 
set ticslevel 0.1 
#set samples 51, 51 
#set isosamples 20, 20 
#set border 1+2+4+8
unset key
splot 'matrix.dat' using 1:2:3 with linespoints, \
'matrix.dat'  using 1:4:5 with linespoints, \
'matrix.dat'  using 1:6:7 with linespoints, \
'matrix.dat'  using 1:8:9 with linespoints, \
'matrix.dat'  using 1:10:11 with linespoints, \
'matrix.dat'  using 1:12:13 with linespoints, \
'matrix.dat'  using 1:14:15 with linespoints

With the resultant plot

enter image description here