Ara*_*ash 4 variables gnuplot vector colors
我正在尝试在gnuplot(版本4.4)中创建具有可变颜色(和线宽)的2D矢量图.我看了几个例子:
splot "vectors.dat" u 1:2:3:4:(rgb($5,$6,$7)) w points pt 7 pointsize var linecolor rgb variable
Run Code Online (Sandbox Code Playgroud)
其中rgb是一种将颜色转换为gnuplot友好格式的函数.
对矢量的修改似乎很简单,但我偶然发现了几个问题.我的示例代码是(用于变量着色):
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
Run Code Online (Sandbox Code Playgroud)
我也尝试在第三列中加0,因为向量的gnuplots表示法是(x,y,z)(dx,dy,dz).此外,我还尝试交换列,并使用随机值.但无论我做什么,箭头都是黑色的.
有什么明显的东西我不见了吗?
提前致谢,
皮疹
我只会提出一种颜色规格,例如
set xrange [0:10]
set yrange [0:10]
plot "test.dat" using 1:2:3:4:5 with vectors lw 3 lc rgb variable
Run Code Online (Sandbox Code Playgroud)
哪里test.dat
包含
1 1 2 0 0x000000
1 2 2 0 0xff0000
1 3 2 0 0xffff00
1 4 2 0 0x382288
Run Code Online (Sandbox Code Playgroud)
使用以下内联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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)