在 GNUplot 步骤图中添加点

Adding points in GNUplot step graph


我有问题。我正在使用带有以下代码的 GNUPlot:

set terminal png
set title 'Assembly ID A047457'
set key autotitle columnhead
set xlabel 'axial coordinate [cm]'
set ylabel 'signal intensity [n/cm]'
set output "output/assembly_001.png"
plot  'data_gnuplot/001.txt' with steps notitle

我的输出很好,但是我想在角落里加点,我不知道怎么加。我只能在左角添加点。你能帮帮我吗?

我的数据文件:

A047457
0 0.1942
5 0.3426
10 0.528
20 0.642
34 0.858
53 0.938
68 0.947
84 1.041
96 0.912
118 0.85
179 0.585
183 0.498
185 0.473
186 0.433
189 0.348
195 0.266
196 0.202
198 0.142
199 0.098

如果我正确理解你的问题,你想把点放在所有角落。

只需将 y 值 "delayed" 乘以 1 再次绘制数据。您可以通过连续评估来做到这一点(检查 help operators binary)。 在第三个绘图命令中 (y0=y1,y1=,y0) 您开始 y1=NaN,然后是 y0=y1,然后是 y2=(数据的当前 y 值),但实际上绘制了 y0。因此,每个 y 值都延迟一个。

代码:

### placing point at all corners of a step plot
reset session

$Data <<EOD
A047457
0 0.1942
5 0.3426
10 0.528
20 0.642
34 0.858
53 0.938
68 0.947
84 1.041
96 0.912
118 0.85
179 0.585
183 0.498
185 0.473
186 0.433
189 0.348
195 0.266
196 0.202
198 0.142
199 0.098
EOD

y1=NaN
plot $Data u 1:2 w steps lw 2 lc rgb "red" notitle, \
     '' u 1:2 w p pt 7 lc rgb "blue" notitle, \
     '' u 1:(y0=y1,y1=,y0) w p pt 7 lc rgb "blue" notitle
### end of code

结果: