I want to do exactly this: https://tex.stackexchange.com/questions/165360/pgfplots-and-gnuplot-how-to-add-asymptote-a-xtick-that-isnt-a-number-and-can/165366#165366?newreg=53a34
The procedure is the same as described in the link you give: Find the inverse of the function and add the result.
The inverse of your function is (f(x)-b)/m
. To display the result, use set arrow
, with the graph
coordinate system to hit the axes, and first
to get the coordinates of the actual intersection.
To add the results on the axes, use set xtics add
and set ytics add
.
An example script (without the fitting part):
reset
set xlabel "Distance (kpc)"
set ylabel "Velocity (km/s)"
set grid
m = 234; b = 1
f(x)=m*x+b
set xrange [0:10]
set yrange [10:]
set tics nomirror
set logscale y
set samples 1000
y = 2000.0
set arrow from graph 0, first y to first (y-b)/m,y nohead lt 3
set arrow from first (y-b)/m, y to first (y-b)/m, graph 0 nohead lt 3
set ytics add (sprintf("%.f", y) y)
set xtics add (sprintf("%.2f", (y-b)/m) (y-b)/m)
plot f(x) lw 2 lc rgb"black"