# How to draw parallel curves using TikZ?

Does anyone know how can I draw the curves in picture using TikZ?

What I have done so far are only two curves which intersect each other but I cannot go further that that. Here's my code

\documentclass[margin=10pt]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=bottom,
axis y line=left,
xmin=0, xmax=10,
ymin=0, ymax=10,
xlabel={Dimension 1},
ylabel={Dimension 2},
ytick=\empty,
xtick={0},
]
\draw (axis cs:2.2,9.5) to [bend right=30] coordinate[pos=0.2] (l_i) (axis cs:8,.5);
\fill (l_i) circle (2.2pt) node[above right] {$B$};

\draw (axis cs:.5,6) to [bend right=10] coordinate[pos=0.8] (dl_j) (axis cs:9,3.5);
\fill (dl_j) circle (2.2pt) node[above right] {$D$};

\end{axis}
\end{tikzpicture}

\end{document}


An easy way to do this is draw the same curve with a yshift. For example, add this to your code:

\draw[yshift=1cm] (axis cs:.5,6) to [bend right=10] coordinate[pos=0.8] (dl_j) (axis cs:9,3.5);


Edit: I overlooked a bit your question. y-shifting would only give a parallel if the non-shifted curve were a straight line... To obtain parallel curves, you could use double lines, as in:

   \draw[double distance=10mm] (axis cs:2.2,9.5) to[bend right=30] (axis cs:8,.5);


But then two other problems appear: (a) positioning the bullets (the coordinate is in the middle of the path, and (b) when you use a double line the second time it will draw on the first (apparently you cannot have a double line with a complete transparent fill). The first problem can be solved rather easily. For example, by manually placing nodes:

   \draw[double distance=10mm] (axis cs:2.2,9.5)
to[bend right=30]
node[circle,draw,fill,sloped,below=4.5mm,pos=0.1,inner sep=1pt] (B) {}
node[circle,draw,fill,sloped,above=4.5mm,pos=0.9,inner sep=1pt] (A) {}
(axis cs:8,.5);
\node[below left] at (A) {$A$};
\node[below left] at (B) {$B$};


But I currently do not know how to fix the second problem. Here is the complete tikzpicture code with problem (b):

\begin{tikzpicture}
\begin{axis}[
axis x line=bottom,
axis y line=left,
xmin=0, xmax=10,
ymin=0, ymax=10,
xlabel={Dimension 1},
ylabel={Dimension 2},
ytick=\empty,
xtick={0},
]
\draw[double distance=10mm] (axis cs:2.2,9.5)
to[bend right=30]
node[circle,draw,fill,sloped,below=4.5mm,pos=0.1,inner sep=1pt] (B) {}
node[circle,draw,fill,sloped,above=4.5mm,pos=0.9,inner sep=1pt] (A) {}
(axis cs:8,.5);
\node[below left] at (A) {$A$};
\node[below left] at (B) {$B$};

\draw[double distance=10mm,double=white] (axis cs:.5,6)
to[bend right=10]
node[circle,draw,fill,sloped,above=4.5mm,pos=0.1,inner sep=1pt] (C) {}
node[circle,draw,fill,sloped,below=4.5mm,pos=0.9,inner sep=1pt] (D) {}
(axis cs:9,3.5);
\node[below left] at (C) {$C$};
\node[above right] at (D) {$D$};
\end{axis}
\end{tikzpicture}

• Many thanks for your suggestion. It works nice for me although I would like to reproduce the same graph as the one above. Do you know how can I draw the same curve that is shifted from the curve having node B on it? Mar 31, 2016 at 8:12
• Well, it seems I overlooked your question. Using my answer the two curves seem to be parallel because the first one is almost horizontal. But they are not exactly parallel, since the second one is only shifted in the y-direction.
– Bibi
Apr 1, 2016 at 9:21
• Once more, thank you for your help. Unfortunately, I have no idea how to escape these problems. Apr 1, 2016 at 14:15