¿Línea vertical y horizontal en intersección?

¿Línea vertical y horizontal en intersección?

Hay un problema en esta fuente:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}

\begin{tikzpicture}
\draw[thick,->] (-1,0) -- (5,0) node(xaxis)[below] {\footnotesize $x$};
\draw[thick,->] (0,-1) -- (0,6.5) node(yaxis)[left] {\footnotesize $y$};
\path [name path=line2] ( 0,4.5 ) -- +( 5,0 );
\path [name path=line1] ( 0,2 ) -- +( 3,0 );
\draw[red,very thick,name path=curve] (0.5,1) .. controls (1.5,3) and (4,2.5) .. (4.5,5.5);
\path [name intersections={of=curve and line2 , by=X}];
\path [name intersections={of=line1 and curve, by=Y}];
\draw (yaxis|-X)node[ left]{\footnotesize $f(b)$} -| ( xaxis-|X)node[below]{\footnotesize $b$};
\draw (yaxis|-Y)node[ left]{\footnotesize $f(a)$} -| ( xaxis-|Y)node[below]{\footnotesize $a$};
\end{tikzpicture}%

\end{document}

¿Cómo se puede eliminar la línea pequeña?ingrese la descripción de la imagen aquí

Respuesta1

Las coordenadas (yaxis |- X)se determinan por el centro del yaxisnodo, no por su borde derecho (este), como le gustaría. Por lo tanto, para todas las coordenadas determinadas en este camino, debe cambiar a yaxis.easty a xaxis.north.

ingrese la descripción de la imagen aquí

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
    \begin{tikzpicture}[font=\footnotesize]
\draw[thick,->] (-1,0) -- (5,0.0) node(xaxis)[below] {$x$};
\draw[thick,->] (0,-1) -- (0,6.5) node(yaxis)[left]  {$y$};
%
\draw[red,very thick,name path=curve] (0.5,1) .. controls (1.5,3) and (4,2.5) .. (4.5,5.5);
\path [name path=line2] (0,4.5) -- +(5,0);
\path [name path=line1] (0,2.0) -- +(3,0);
%
\path [name intersections={of=curve and line2 , by=X}];
\path [name intersections={of=line1 and curve, by=Y}];
%
\draw (yaxis.east |- X) node[left] {$f(b)$} -| (xaxis.north -| X)node[below]{$b$};
\draw (yaxis.east |- Y) node[left] {$f(a)$} -| (xaxis.north -| Y)node[below]{$a$};
    \end{tikzpicture}%
\end{document}

Como puedes ver, modifiqué ligeramente tu MWE.

información relacionada