seckcoder

Bring Reality to Games

 

gnuplot 设定点的颜色

Example: 

#!/bin/sh
gnuplot << EOF
set terminal png
set output
"../Data/test_Mean_Shift.png"
plot
"$1" using 1:2:3 with circles,\
"$2" using 1:2:3 with points lc rgb var
EOF


其中"rgb var"指lc 的 rgbcolor是一个与using中的第三个量即$3。 

 

假如改为

plot "$1" using 1:2:3 with circles,\
"$2" using 1:2:3:4 with points ps var lc rgb var

此时ps var对应$3, rgb var 对应$4 。

 

此时rgbvar 只对应3中的一个值; rgb以int表示为(r,g,b), 则$3 = r * 65536 + g * 256 + b;

显然前面例子中设置的rgb值不够直观; 更好的方式是在.plt文件中使用如下:

set terminal png
set output
"../Data/test_Mean_Shift.png"

rgb(r,g,b)
= int(r) * 65536 + int(g) * 256 + int(b)
plot
"file1.dat" using 1:2:3 with circles,\
"file2.dat" using 1:2:rgb($3,$4,$5) with points lc rgb var

此时使用($3,$4,$5)对应rgb value, 利用函数rgb(r,g,b)计算利于值。

但是这在bash下无法使用, 因为$在bash中对应bash的参数。  

posted on 2011-08-23 20:34  seckcoder  阅读(2438)  评论(0编辑  收藏  举报

导航