2
votes


I have question. I am using GNUplot with following code:

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

I have nice output, bud I want to add points in corners, I dont know, how to add them. I can add point only to left corners. Can you help me please?

This is what I need

This is my output

And my datafile:

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
1

1 Answers

2
votes

If I understand your question correctly you want to place the points at all corners.

Just plot the data again with the y-value "delayed" by one. You can do this with serial evaluation (check help operators binary). In the third plot command (y0=y1,y1=$2,y0) you start y1=NaN, then y0=y1, then y2=$2 (the current y-value of your data), but y0 is actually plotted. So, every y-value is delayed by one.

Code:

### 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=$2,y0) w p pt 7 lc rgb "blue" notitle
### end of code

Result:

enter image description here