【发布时间】:2022-11-22 22:11:13
【问题描述】:
我的问题类似于这个: vary point color based on column value for multiple data blocks gnuplot
除了上面没有给出对所用语法及其含义的解释之外......
数据如下所示:
格 | G_Y_G_V_T | Kocc_OV_S0_S1_B1,2_S2_B2,3_S3_B3,4_S4_S5
| Wocc_OV_S0_S1_B1,2_S2_B2,3_S3_B3,4_S4_S5
| :------: | :------------:| :---: | :---: |
0 | 0F_0F_0F_0F_0F | 0_0_0_0_0_0_0_0_0_0 | 1_0_0_0_0_0_0_0_0_0 |
4.046025985 | 0F_2Fo_0F_2Fo_0F 0_0_1_0_0_0_0_0_1_0 | 1_1_0_0_0_0_1_0_0_0 |
2.941144083 | 0F_0F_0F_0F_0F |0_0_1_0_0_1_0_0_0_1 | 1_0_0_0_1_0_0_0_0_0 |
1.836301245 | 0F_0F_0F_2Fo_0F | 0_0_0_0_0_0_0_0_0_0 | 1_0_0_0_0_0_0_0_0_0 |
0.90317579 | 0F_0F_0F_2Fo_0F | 0_0_0_1_0_0_0_1_0_0 | 1_0_1_0_0_1_0_0_1_0 |
3.826663156 | 0F_0F_0F_0F_0F | 0_1_0_0_1_0_1_0_0_1 | 1_0_1_0_0_0_0_0_0_0 |
在我的数据文件中,有 100 行,其中第 1 列用于调色板,第 2-4 列是两个不同图上 X、Y 轴的标签
我想要的是第 3 列和第 4 列的 X、Y 散点图,其中第 1 列用于为图上的每个点着色。
这是我的脚本尝试:
set title "K and W Occupancy \n KcsA, Replica 0, 0 mV "
set xlabel "POT" font ",18"
set ylabel "Water" font ",18"
set cblabel "Free energy (kT)" font ",18"
set xtics rotate by -45
set xtics out font ", 13" nomirror
set ytics out font ", 13" nomirror
set pointsize 0.4
set xrange [0:100]
iset yrange [0:100]
set cbrange [0:10]
# MATLAB jet color pallete --> from https://github.com/Gnuplotting/gnuplot-palettes/blob/master/jet.pal
# palette
set palette defined (0 0.0 0.0 0.5, \
1 0.0 0.0 1.0, \
2 0.0 0.5 1.0, \
3 0.0 1.0 1.0, \
4 0.5 1.0 0.5, \
5 1.0 1.0 0.0, \
6 1.0 0.5 0.0, \
7 1.0 0.0 0.0, \
8 0.5 0.0 0.0 )
splot '$filename' using 3:4:($1 <= 10 ? 0 : 1) w p pointtype 5 pointsize 1 palette linewidth 10
我真的不知道这意味着什么: ($1 <= 10 ? 0 : 1)
为什么脚本会绘制数据放置不正确的 3D 图形?
预计二维图在 X 轴和 Y 轴上具有独特的条目,每个点都沿着色标着色。
上述尝试导致 3D 图和点不正确。
我读过的类似问题的多个答案没有解释 gnuplot 脚本中每个术语的含义,包括:
Plotting style based on an entry in a data-file
gnuplot splot colors based on a fourth column of the data file
vary point color based on column value for multiple data blocks gnuplot
【问题讨论】: