Jes*_*caB 19 variables gnuplot colors
我需要根据一列中的颜色改变一行值的点颜色.数据:
# x y z
1, 3, 0
1, 5, 6
3, 5, 2
4, 5, 0
Run Code Online (Sandbox Code Playgroud)
如果列为零,则颜色应为一个值;如果第三列中的值为非零,则颜色应为不同的颜色.
所以,我假设:
plot "./file.dat" u 1:2:3 with points palette
Run Code Online (Sandbox Code Playgroud)
在这里找到:https://stackoverflow.com/a/4115001将无法正常工作.
在上面的示例数据中,该gnuplot命令提供了三种不同的颜色,而不是我正在寻找的两种颜色.
vae*_*hen 27
这可能接近你想要的:
set palette model RGB defined ( 0 'red', 1 'green' )
plot[0:5][0:6] "file.dat" u 1:2:( $3 == 0 ? 0 : 1 ) with points palette
Run Code Online (Sandbox Code Playgroud)
你可以更进一步,消除"噪音":
unset key
unset colorbox
plot[0:5][0:6] "file.dat" u 1:2:( $3 == 0 ? 0 : 1 ) with points pt 7 ps 3 palette
Run Code Online (Sandbox Code Playgroud)
如果只有零和非零之间的区别.
您可以通过以下方式调整调色板
set palette defined (-0.1 "blue", 0 "red", 0.1 "blue")
Run Code Online (Sandbox Code Playgroud)