Graph 如何用不同的颜色绘制多个向量?

Graph 如何用不同的颜色绘制多个向量?,graph,gnuplot,Graph,Gnuplot,我想用gnuplot来画线。 数据文件为: #X1 y1 x2 y2 colorNumber 123 567 798 900 1 788 900 87 89 2 .... 我创建了一个调色板 set palette model RGB defined ( 1 'violet', 2 'red', 3 'blue', 4 'yellow', 5 'green', 6 'orange', 7 'cyan') 我如何用它的颜色画每条线 我试着跟着,但效果不好 plot '~/Desktop/po

我想用gnuplot来画线。 数据文件为:

#X1 y1 x2 y2 colorNumber
123 567 798 900 1
788 900 87  89 2
....
我创建了一个调色板

set palette model RGB defined ( 1 'violet', 2 'red', 3 'blue', 4 'yellow', 5 'green', 6 'orange', 7 'cyan')
我如何用它的颜色画每条线

我试着跟着,但效果不好

plot '~/Desktop/pointcolor.txt' using 1:2:($3-$1):($4-$2):3 with vectors palette nohead notitle
这是结果,问题是线条颜色与我定义的颜色不匹配


您的数据文件总共包含五列,第五列包含所需的颜色编号。所以你需要

plot '~/Desktop/pointcolor.txt' using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle