I want to draw diagrams like the ones in the picture of this question.

Is there a tikz package for that? If not, do you have any LaTeX code to look at? I can't find anything.

   \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);}
   \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
   \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$};

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.