# Make a specific dashed parabola curve connecting two points in Tikz

I have my tex code for this figure a square 1-2-3-4 with a dashed line connecting p2 and p3 by a intermediate point p23.

How can we make a ( curved) dashed parabola curve (or just any more smooth curve) connecting p2, p23 and p3? Thank you, please make it a short answer.

\begin{tikzpicture}[scale=1,baseline]

\coordinate (p1) at (0,0);

\coordinate (p2) at (0,1);

\coordinate (p3) at (1,0);

\coordinate (p4) at (1,1);

\coordinate (p23) at (.7,.7);

\draw [-,>=latex,line width=0.5pt] (p2) -- (p1);

\draw [-,>=latex,line width=0.5pt] (p4) -- (p3);

\draw [-,>=latex,line width=0.5pt] (p3) -- (p1);

\draw [-,>=latex,line width=0.5pt] (p4) -- (p2);

\draw [-,>=latex, dashed, line width=0.5pt] (p23) -- (p2);

\draw [-,>=latex, dashed, line width=0.5pt] (p23) -- (p3);

\node at (-0.15,-0.15) {1};

\node at (-0.15,1.15) {3};

\node at (1.15,-0.15) {2};

\node at (1.15,1.15) {4};

\end{tikzpicture}
}

-
do you want a parabola or just a smooth curve passing through three points? – percusse Apr 3 '14 at 5:51
Either parabola or a smooth curve, both is fine. – Idear Apr 3 '14 at 13:34

Here are three options.

\draw [densely dashed, line width=0.5pt] (p2) edge[bend left=40,looseness=1.5] (p3);
\draw [red,densely dashed, line width=0.5pt] (p2) edge[bend left=40,distance=1cm] (p3);
\draw [blue,densely dashed, line width=0.5pt] (p2) edge[controls=+(0:1) and +(90:1)] (p3);


Adjust the parameters to suit your needs. For more details, read pgfmanual section 70.3, pages 753 onwards.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=1,baseline]

\coordinate (p1) at (0,0);

\coordinate (p2) at (0,1);

\coordinate (p3) at (1,0);

\coordinate (p4) at (1,1);

\coordinate (p23) at (.7,.7);

\draw [-,>=latex,line width=0.5pt] (p2) -- (p1);

\draw [-,>=latex,line width=0.5pt] (p4) -- (p3);

\draw [-,>=latex,line width=0.5pt] (p3) -- (p1);

\draw [-,>=latex,line width=0.5pt] (p4) -- (p2);

%\draw [-,>=latex, dashed, line width=0.5pt] (p23) -- (p2);
%
%\draw [-,>=latex, dashed, line width=0.5pt] (p23) -- (p3);
\draw [densely dashed, line width=0.5pt] (p2) edge[bend left=40,looseness=1.5] (p3);
\draw [red,densely dashed, line width=0.5pt] (p2) edge[bend left=40,distance=1cm] (p3);
\draw [blue,densely dashed, line width=0.5pt] (p2) edge[controls=+(0:1) and +(90:1)] (p3);

\node at (-0.15,-0.15) {1};

\node at (-0.15,1.15) {3};

\node at (1.15,-0.15) {2};

\node at (1.15,1.15) {4};

\end{tikzpicture}
\end{document}


-
Thank you Harish, your answer looks really nice. Let me give it a try. – Idear Apr 3 '14 at 13:33

Simply change these two lines just above the \node commands

\draw [-,>=latex, dashed, line width=0.5pt] (p23) -- (p2);
\draw [-,>=latex, dashed, line width=0.5pt] (p23) -- (p3);


into

\draw [-,>=latex, dashed, line width=0.5pt] (p2) .. controls (p23) .. (p3);


-
Thanks +1, can it be more smooth than that? like a parabola from p2-p23-p3? Thank you really. – Idear Apr 3 '14 at 4:22
perhaps one way just adding more points. – Idear Apr 3 '14 at 4:24
OK, Yes, (p2) .. controls (p23) and (extra pt here) .. (p3); of Benzier curve. Another way is, for example, \draw p(2) [in=30,out=150] p(3); the angle can be changed by users. – Jesse Apr 3 '14 at 4:25
Thanks, but somehow this [in=30, out=150] has bug??? – Idear Apr 3 '14 at 4:40
Correction: \draw p(2) to[in=x,out=y] p(3); forget the to – Jesse Apr 3 '14 at 4:41