I have a random smooth drawing (just smoothly connecting dots) and want to highlight a point between the dots. Highlighting should happen by connecting the point on the graph with its coordinate on the x-axis.
Here is a MWE that I would like to keep as it is
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ytick=\empty,xtick=\empty,
axis on top=false,xmin=0, xmax=10, ymin=0, ymax=5,
axis x line=left, axis y line=left, clip=false]
\node at (rel axis cs:1,0) [above, anchor=north west] {$x$};
\node at (rel axis cs:0,1) [above, anchor=west] {$y$};
\addplot[smooth] coordinates {
(0,0)
(2,3)
(5,1.2)
(5.8,4)
(8,3.8)
(10,3.5)
} coordinate [pos=.9] (prior) ;
\end{axis}
\end{tikzpicture}
\end{document}
I want to connect the coordinate prior
with the x-axis using a line parallel to the y-axis. My take was this
\draw[dotted] (prior)-- (rel axis cs:0.9,0);
However, for some reason unclear to me, this is not the right coordinate (it is a bit to the right). Now I wonder, how can I asses the right coordinate? The function plots a range from 0:10
so my math skills would hinge that .9
of this should also be .9
of the length of the x-axis. However, this seems to be incorrect. Has anybody an idea what the right coordinate is? Or even simpler: How can I connect the point (prior) with the x-axis in the shortest possible way?
I tried to work with the solution suggested in an answer to this question:Smooth pgfplots. The problem is that I do not know the y-coordinate of the point prior.
For completeness here is the output it produces (never mind the different labels of the axis)