gnuplot - plot different blocks with different color

大城市里の小女人 提交于 2019-12-23 09:55:34

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!