我如何使用 tikzpicture 绘制这样的图片?

我如何使用 tikzpicture 绘制这样的图片?

我怎样才能用 绘制这样的图片tikzpicture

在此处输入图片描述

答案1

这是一个带有控制点等选项的版本bent left

\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}

在此处输入图片描述

答案2

\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}

在此处输入图片描述

答案3

PSTricks 解决方案。

\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}

在此处输入图片描述

答案4

还有一个选择……

\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}

在此处输入图片描述

相关内容