如何绘制同伦图?

如何绘制同伦图?

我想画出如下图所示的图表这个问题

有没有适合这个的 tikz 包?如果没有,你有没有 LaTeX 代码可以看看?我什么都找不到。

答案1

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{subfig}
\begin{document}
\begin{figure}
 \subfloat{
  \begin{tikzpicture}
   \coordinate (O) at (0,0);
   \coordinate (P) at (5,5);
   \draw[-latex] (O) -- ++(6,0) node[above]{$s$};
   \draw[-latex] (O) -- ++(0,6) node[left]{$t$};
   \draw (O|-P) coordinate (OP)--(P)--(O-|P);
   \draw[thick] (O) -- ([xshift=2cm]O|-P) coordinate (P1);
   \path (O|-P) -- (P1) node[midway,above] {$c_p$};
   \node at (barycentric cs:O=1,P1=1,OP=1) {$p$};
   \path (P1) -- (P) node[midway,above]{$f$} coordinate[pos=1/4] (P2)
   coordinate[pos=1/2] (P3) coordinate[pos=3/4] (P4);
   \path (O) -- (O-|P)    coordinate[pos=1/4] (O2)
   coordinate[pos=1/2] (O3) coordinate[pos=3/4] (O4) node[midway,below]{$f$};
   \foreach \i in {2,3,4} 
   {\draw (O\i) -- (P\i);}
  \end{tikzpicture}
 }
 \quad
 \subfloat{
  \begin{tikzpicture}
   \coordinate (O) at (0,0);
   \coordinate (P) at (5,5);
   \draw[-latex] (O) -- ++(6,0) node[above]{$s$};
   \draw[-latex] (O) -- ++(0,6) node[left]{$t$};
   \draw (O|-P) coordinate (OP)--(P) coordinate[midway](top) --(O-|P) coordinate
   (PO);
   \path (O|-P) -- (top) node[midway,above]{$f$} coordinate[pos=1/4](x1) 
   coordinate[pos=1/2](x2) coordinate[pos=3/4](x3);
   \path (top) -- (P) node[midway,above]{$f^{-1}$} coordinate[pos=1/4](y3) 
   coordinate[pos=1/2](y2) coordinate[pos=3/4](y1);
   \draw[thick,name path=triangle] (O) -- (top) -- (PO);
   \foreach \i in {1,2,3}
   {\path[name path=X\i] (x\i)--(x\i|-O);
   \path [name intersections={of=triangle and X\i,by={A\i}}];
   \path[name path=Y\i] (y\i)--(y\i|-O);
   \path [name intersections={of=triangle and Y\i,by={B\i}}];
   \draw (x\i) -- (A\i) -- (B\i) -- (y\i);
   }
   \path (O) -- (O-|P) node[midway,below] {$c_p$};
  \end{tikzpicture}
 }
\end{figure}
\end{document}

在此处输入图片描述

相关内容