Вы можете использовать троичный оператор (отметьте help ternary
), чтобы извлечь ваше значение при построении линии with vectors
и повторно использовать значение в легенде с keyentry
. Ниже приведен минимальный пример, который вы можете адаптировать к вашим потребностям.
Код:
### extract value from a dataset (or file)
reset session
$Data <<EOD
Index Value
1 5.1
2 5.3
3 5.6
EOD
# Gauss curve by specifing Amplitude A, position x0 and width via FWHM
GaussW(x,x0,A,FWHM) = A * exp(-(x-x0)**2/(2*(FWHM/(2*sqrt(2*log(2))))**2))
set xrange[0:10]
set samples 30
set style line 1 lc rgb "red" lw 1.5
set key top left samplen 1.5
set multiplot layout 1,3
Index = 1
plot GaussW(x,5.4,0.4,2.5) w boxes ti "Histogram", \
$Data u ($1==Index?Value=$2:NaN):(0):(0):(0.5) w vectors ls 1 nohead notitle, \
keyentry w l ls 1 ti sprintf("%g",Value)
Index = 2
plot GaussW(x,5.4,0.4,2.5) w boxes ti "Histogram", \
$Data u ($1==Index?Value=$2:NaN):(0):(0):(0.5) w vectors ls 1 nohead notitle, \
keyentry w l ls 1 ti sprintf("%g",Value)
Index = 3
plot GaussW(x,5.4,0.4,2.5) w boxes ti "Histogram", \
$Data u ($1==Index?Value=$2:NaN):(0):(0):(0.5) w vectors ls 1 nohead notitle, \
keyentry w l ls 1 ti sprintf("%g",Value)
unset multiplot
### end of code
Результат:
![enter image description here](https://i.stack.imgur.com/VlCVO.png)