问题
I have a data like this in a file.dat
2 2
5 5
7 3
100 102
130 80
116 134
-40 -100
-50 -60
-61 -58
I would want to plot each block in different color,
There is no restriction that a specific color, but just some visually different color.
I tried with linetype like this:
for [IDX=0:2] 'file.dat' i IDX u 1:2 with linespoints linetype IDX
it plots all the blocks with different color and obviously only last one is visible.
So what is the right way to do this?
回答1:
That is the right way, but you must have two blank lines in order to access different blocks with index.
And, you should start at linetype 1, because linetype 0 is a special linetype for the grid lines:
2 2
5 5
7 3
100 102
130 80
116 134
-40 -100
-50 -60
-61 -58
And the plot command
plot for [IDX=0:2] 'file.dat' index IDX u 1:2 with lp lt IDX+1
来源:https://stackoverflow.com/questions/34759627/gnuplot-plot-different-blocks-with-different-color