Gnuplot: color variables (and line widths) for 2D vector graphics

I am trying to create a 2D vector plot with variable colors (and line width) in gnuplot (version 4.4). I looked at examples for points:

splot "vectors.dat" u 1:2:3:4:(rgb($5,$6,$7)) w points pt 7 pointsize var linecolor rgb variable

where rgb is a function that converts color to the friendly gnuplot format.

Modifying to vectors seemed simple, but I came across several problems. My sample code (for variable coloring):

splot "vectors.dat" u 1:2:(rgb($5,$6,$7)):3:4:(rgb($5,$6,$7)) with vectors head filled size screen 0.05,15,45 linetype 1 linewidth 2 linecolor rgb variable

I also tried putting 0 in the third column, since the designation of the vector is gnuplots (x, y, z) (dx, dy, dz). In addition, I also tried to swap columns and use random values. But no matter what I do, the arrows remain black.

Is there something obvious that I'm missing?

Thanks in advance,

Arash

+3
source share
2

, .

set xrange [0:10]
set yrange [0:10]
plot "test.dat" using 1:2:3:4:5 with vectors lw 3 lc rgb variable

test.dat

1 1 2 0 0x000000
1 2 2 0 0xff0000
1 3 2 0 0xffff00
1 4 2 0 0x382288

enter image description here

, rgb

rgb(r,g,b) = int(r)*65536 + int(g)*256 + int(b)
plot "test2.dat" using 1:2:3:4:(rgb($5,$6,$7)) with vectors lw 3 lc rgb variable

test2.dat

1 1 2 0 0 0 0
1 2 2 0 255 0 0
1 3 2 0 255 255 0
1 4 2 0 56 34 136
+5

, , palette cbrange, . ( Gnuplot 4.6)

set cbrange [0:1]
set palette rgbformulae 33,13,10
plot "data" using 1:2:3:4:(sqrt($3**2+$4**2)) with vectors linecolor palette z
+3

All Articles