基于 CSV 文件列值在 Gnuplot 中使用不同的颜色
Using different colors in Gnuplot based on a CSV file column value
我有一个具有以下结构的 CSV 文件:
X,Y,Z
其中 X 和 Y 是正方形图上的坐标,Z 可以是 0/1。我想根据 Z 列中的值绘制不同颜色的点。
这可能吗?
到目前为止,我有一个文件,它只在方形图表上显示所有数据,并只用一种颜色给它们着色:
filename='test.csv'
set datafile separator ","
set title filename
set size square
plot filename using 0:1 linecolor rgb "yellow"
文档里都有,看help rgbcolor variable
:
rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
color1=rgb(255,0,0); color2=rgb(0,255,0)
plot fname using 1:2:(==0?color1:color2) w p lc rgb variable
我有一个具有以下结构的 CSV 文件:
X,Y,Z
其中 X 和 Y 是正方形图上的坐标,Z 可以是 0/1。我想根据 Z 列中的值绘制不同颜色的点。
这可能吗?
到目前为止,我有一个文件,它只在方形图表上显示所有数据,并只用一种颜色给它们着色:
filename='test.csv'
set datafile separator ","
set title filename
set size square
plot filename using 0:1 linecolor rgb "yellow"
文档里都有,看help rgbcolor variable
:
rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
color1=rgb(255,0,0); color2=rgb(0,255,0)
plot fname using 1:2:(==0?color1:color2) w p lc rgb variable