Add one point on an existing site

I use the following script to fit functions on the chart. On the output graph, I would like to add a single value with a label on the fit curve, say point f (3.25). I read that it is very difficult for gnuplot to add one point on the graph, especially when this graph is a suitable function graph.

Does anyone have an idea how to add this single point to an existing plot?

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 
+8
gnuplot
source share
2 answers

There are several options for setting a point / point:

1. set object

If you have simple points, such as a circle, circle wedge, or square, you can use the set object , which must be defined before the corresponding plot command:

 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 

To add a label, you need to use set label .

This can be cumbersome, but it has the advantage that you can use different colors of lines and fills, and you can use different coordinate systems ( first , graph , screen , etc.).

Result from 4.6.4:

enter image description here

2. Set a blank label with a point option

The set label command has a point parameter that can be used to set a point using existing point types at a specific coordinate:

 set label at xPos, yPos, zPos "" point pointtype 7 pointsize 2 

3. plot with '+'

The last possibility is to use a special file name + , which generates a set of coordinates, which are then filtered and constructed using the labels (or points , style if no labels are requested:

 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 

$0 , or equivalently column(0) , is the coordinate index. In the using statement, only the first is accepted as valid, all others are skipped (using NaN ).

Note that using + requires the installation of a fixed xrange .

This has advantages (or disadvantages?):

  • You can use regular pointtype .
  • You can use only axis values ​​as coordinates (for example, first or second for objects above).
  • It may be difficult to place different types of points.
  • He more actively uses different colors of borders and fills.

Result:

enter image description here

+15
source share

Adding to Christoph excellent answers:

4. use stdin to convey at one point

 replot "-" using 1:(f($1)) 2.0 e 

and use the method in the third answer to tag it.

5. bake a named data block (version> 5.0) that contains one point, then you can rebuild the graph without re-submitting it every time:

 $point << EOD 2.0 EOD replot $point using 1:(f($1)):(sprintf("%.2f",f($1))) with labels 
+4
source share

All Articles