gnuplot の plot ... with points ... でプロットした個別の点に色をつける方法


できたPostScriptファイルのスクリーンショット
自分用 Tips. gnuplot の plot コマンドで with points で点を打って、そのプロットマークに自分の指定した色を着色する方法。手許の環境は WinXP SP3/gnuplot4.2 である。
ヘルプの colorspec というエントリの Examples: を参考にしたコマンド

rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
plot "test.txt" using 1:2:(rgb($3,$4,$5)) with points pt 5 lc rgb variable

データファイルのサンプル test.txt

1 1 255 0 0
2 2 0 255 0

PostScriptに吐き出してみる

set terminal postscript eps
set output "test.ps" 
set xrange [-0.1:2.1]
set yrange [-0.1:2.1]
rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
plot "test.txt" using 1:2:(rgb($3,$4,$5)) with points pt 5 lc rgb variable