我使用以下脚本来拟合图上的函数.在输出图中,我想在拟合曲线上添加一个带礼仪的值,让我们说点f(3.25).我已经读过,对于gnuplot来说,在绘图上添加一个单点是非常棘手的,特别是当这个图是拟合函数图时.
有人知道如何在现有情节上添加这一点吗?
set xlabel "1000/T (K^-^1)" font "Helvetica,20"
#set ylabel "-log(tau_c)" font "Helvetica,20"
set ylabel "-log{/Symbol t}_c (ns)" font "Helvetica,20"
set title "$system $type $method" font "Helvetica,24"
set xtics font "Helvetica Bold, 18"
set ytics font "Helvetica Bold, 18"
#set xrange[0:4]
set border linewidth 3
set xtic auto # set xtics automatically
set ytic auto # set ytics automatically
#set key on bottom box lw 3 width 8 height .5 spacing 4 font "Helvetica, 24"
set key box lw 3 width 4 height .5 spacing 4 font "Helvetica, 24"
set yrange[-5:]
set xrange[1.5:8]
f(x)=A+B*x/(1000-C*x)
A=1 ;B=-227 ; C=245
fit f(x) "$plot1" u (1000/\$1):(-log10(\$2)) via A,B,C
plot [1.5:8] f(x) ti "VFT" lw 4, "$plot1" u (1000/\$1):(-log10(\$2)) ti "$system $type" lw 10
#set key on bottom box lw 3 width 8 height .5 spacing 4 font "Helvetica, 24"
set terminal postscript eps color dl 2 lw 1 enhanced # font "Helvetica,20"
set output "KWW.eps"
replot
Run Code Online (Sandbox Code Playgroud)
Chr*_*oph 18
设置点/点有几种可能性:
如果你有简单的点,如圆形,圆形楔形或正方形,你可以使用set object,必须在相应的plot命令之前定义:
set object circle at first -5,5 radius char 0.5 \
fillstyle empty border lc rgb '#aa1100' lw 2
set object circle at graph 0.5,0.9 radius char 1 arc [0:-90] \
fillcolor rgb 'red' fillstyle solid noborder
set object rectangle at screen 0.6, 0.2 size char 1, char 0.6 \
fillcolor rgb 'blue' fillstyle solid border lt 2 lw 2
plot x
Run Code Online (Sandbox Code Playgroud)
要添加标签,您需要使用set label.
这可能是麻烦的,但你可以使用不同的线条和填充颜色的优势,并且可以使用不同的坐标系(first,graph,screen等).
4.6.4的结果是:

该set label命令有一个point选项,可用于使用特定坐标处的现有点类型设置点:
set label at xPos, yPos, zPos "" point pointtype 7 pointsize 2
Run Code Online (Sandbox Code Playgroud)
最后一种可能是使用特殊文件名+,它生成一组坐标,然后过滤,并使用labels绘图样式绘制(或者points如果没有请求标签:
f(x) = x**2
x1 = 2
set xrange[-5:5]
set style line 1 pointtype 7 linecolor rgb '#22aa22' pointsize 2
plot f(x), \
'+' using ($0 == 0 ? x1 : NaN):(f(x1)):(sprintf('f(%.1f)', x1)) \
with labels offset char 1,-0.2 left textcolor rgb 'blue' \
point linestyle 1 notitle
Run Code Online (Sandbox Code Playgroud)
$0或等效地column(0),是坐标索引.在using语句中,只有第一个被认为是有效的,所有其他的被跳过(使用NaN).
注意,使用+需要设置固定xrange.
这有什么优点(或缺点?):
pointtype.first或second为上面的对象).结果是:

加入Christoph的优秀答案:
4.用于stdin管道的一点
replot "-" using 1:(f($1))
2.0
e
Run Code Online (Sandbox Code Playgroud)
并使用第3个答案中的方法来标记它.
5.烘焙 包含一个点的命名数据块(版本> 5.0),然后您可以重新绘制而不是每次都重新提供它:
$point << EOD
2.0
EOD
replot $point using 1:(f($1)):(sprintf("%.2f",f($1))) with labels
Run Code Online (Sandbox Code Playgroud)