2

How do I draw picture like this with tikzpicture?

enter image description here

1
  • 2
    Welcome to TeX.SX! Please show what you've got (MWE).
    – TeXnician
    Apr 9, 2017 at 16:21

4 Answers 4

6

Here's a version with control points and bent left etc. options as well.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}[thick]
\def\upperarc{2}
\def\lowerarc{1.2}
\coordinate (P) at (0,0);
\coordinate (Q) at (4,0);
\foreach \x in {P,Q} {
  \draw[fill] (\x) circle (0.05);
}
\node[left] (P1) at (P) {$P$};
\node[right] (Q1) at (Q) {$Q$};
\coordinate (PQ) at ($(P)!.5!(Q)$);
\draw (P) -- ($(PQ)-(0.5,0)$);
\draw ($(PQ)+(0.5,0)$) -- (Q);
\node (air) at (PQ) {air};
\coordinate (CPQ1) at ($(PQ) - (1,0)$);
\coordinate (CPQ2) at ($(PQ) + (1,0)$);
\draw[dashed] let \p{1}=(CPQ1),\p{2}=(CPQ2) in (P) .. controls (\x1,\upperarc) and (\x2,\upperarc) .. (Q);
\draw[dashed] let \p{1}=(CPQ1),\p{2}=(CPQ2) in (P) .. controls (\x1,\lowerarc) and (\x2,\lowerarc) .. node[midway,above] {sea} (Q);
\draw (P) to [bend left=30]  (Q);
\draw (P) to [bend right=30]  (Q);
\draw[dotted] (P) to [bend right=30] (Q);
\draw[dotted] let \p{1}=(CPQ1),\p{2}=(CPQ2) in (P) .. controls (\x1,-\upperarc) and (\x2,-\upperarc) .. (Q);
\draw[dotted] let \p{1}=(CPQ1),\p{2}=(CPQ2) in (P) .. controls (\x1,-\lowerarc) and (\x2,-\lowerarc) .. node[midway,below] {road} (Q);
\end{tikzpicture}

\end{document}

enter image description here

0
5
\documentclass[tikz]{standalone}
\begin{document}
    \begin{tikzpicture}
        \coordinate (P) at (-3,0);
        \coordinate (Q) at (3,0);
        \draw [fill=black] (P) circle (0.05) node [left] {$P$};
        \draw [fill=black] (Q) circle (0.05) node [right] {$Q$};
        \draw[] (P) to[bend left = 20](Q);
        \draw[dashed] (P) to[bend left =40]  node[above] {\small sea} (Q);
        \draw[dashed] (P) to[bend left =70] (Q);
        \draw[] (P) -- node [circle, fill=white] {\small air} (Q); %================================
        \draw[] (P) to[bend right =20] (Q);
        \draw[dotted] (P) to[bend right =40]  node[below] {\small road} (Q);
        \draw[dotted] (P) to[bend right =70] (Q);
    \end{tikzpicture}
\end{document}

enter image description here

5

A PSTricks solution.

\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}[](-6,-3)(6,3)
        \pstGeonode[PosAngle={180,0}](-5,0){P}(5,0){Q}
        \ncarc[arcangle=60,linestyle=dashed]{P}{Q}\nbput{sea}
        \ncarc[arcangle=40,linestyle=dashed]{P}{Q}
        \ncarc[arcangle=20]{P}{Q}
        \ncline{P}{Q}\ncput*{air}
        \ncarc[arcangle=-20]{P}{Q}
        \ncarc[arcangle=-40,linestyle=dashed]{P}{Q}
        \ncarc[arcangle=-60,linestyle=dashed]{P}{Q}\naput{road}
\end{pspicture}
\end{document}

enter image description here

1
  • 1
    (+1) The lower curves should be dotted.
    – Bernard
    Apr 9, 2017 at 18:46
4

one more alternative ...

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}[thick,
node distance = 5mm and 40mm,
    looseness = 1.2,
   dot/.style = {circle,fill=black, inner sep=1pt, node contents={}},
                    ]
\node (p) [dot,label= left:$P$, at={(0,0)}];
\node (q) [dot,label=right:$Q$, right=of p];
\draw[dashed] (p) to [out= 60,in= 120]  (q)
              (p) to [out= 30,in= 150] node[above] {sea}  (q); 
\draw[dotted] (p) to [out=-30,in=-150] node[below] {road} (q)
              (p) to [out=-60,in=-120]  (q);
        \draw (p) to [out= 15,in= 165]  (q)
              (p) -- node[fill=white] {air}  (q)
              (p) to [out=-15,in=-165]  (q);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .