user3806649
user3806649

Reputation: 1317

How to draw multiple vectors with different color?

I want to draw lines using gnuplot. data file is:

#X1 y1 x2 y2 colorNumber
123 567 798 900 1
788 900 87  89 2
....

I create a palette

set palette model RGB defined ( 1 'violet', 2 'red', 3 'blue', 4 'yellow', 5 'green', 6 'orange', 7 'cyan')

How can I draw each line with its color?

I try followng but it didn't work fine.

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

here is the result, the problem is line color didn't match with what I have deffined.

Graph

Upvotes: 2

Views: 345

Answers (1)

Christoph
Christoph

Reputation: 48430

You data file contains a total of five columns, the fifth one contains your desired color numbers. So you need

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

Upvotes: 2

Related Questions