[Tex/LaTex] How to draw manifolds charts with TikZ

macrostikz-pgf

I'm quite new to TikZ, so I would love to get some help with the drawing! What I intended to draw was not exactly what is shown in the picture, as that is probably not possible. I only want to draw a similar photo within the boundaries of TikZ. That is, The function f on M is a map from M to R^1. The coordinate map g from a region U of M containing P onto a region g(U) of R^n has an inverse. The composite map fog^{-1} gives a map from R^n to R^1, which is a function on R^n.the surfaces themselves don't have to curve exactly like the ones in the photo.

Here is the code

\documentclass[border=5mm,tikz]{standalone}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepgfplotslibrary{patchplots}
\usetikzlibrary{patterns, positioning, arrows}
\pgfplotsset{compat=1.8}
\usepackage{tikz}


\begin{document}

\begin{tikzpicture}

    % Functions i
    \path[->] (0.8, 0) edge [bend right] node[left, xshift=-2mm] {$\phi_i$} (-1, -2.9);
    \draw[white,fill=white] (0.06,-0.57) circle (.15cm);
    \path[->] (-0.7, -3.05) edge [bend right] node [right, yshift=-3mm] {$\phi^{-1}_i$} (1.093, -0.11);
    \draw[white, fill=white] (0.95,-1.2) circle (.15cm);

    % Functions j
    \path[->] (5.8, -2.8) edge [bend left] node[midway, xshift=-5mm, yshift=-3mm] {$\phi^{-1}_j$} (3.8, -0.35);
    \draw[white, fill=white] (4,-1.1) circle (.15cm);
    \path[->] (4.2, 0) edge [bend left] node[right, xshift=2mm] {$\phi_j$} (6.2, -2.8);
    \draw[white, fill=white] (4.54,-0.12) circle (.15cm);

    % Manifold
    \draw[smooth cycle, tension=0.4, fill=white, pattern color=brown, pattern=north west lines, opacity=0.7] plot coordinates{(2,2) (-0.5,0) (3,-2) (5,1)} node at (3,2.3) {$M$};

    % Help lines
    %\draw[help lines] (-3,-6) grid (8,6);

    % Subsets
    \draw[smooth cycle, pattern color=orange, pattern=crosshatch dots] plot coordinates {(1,0) (1.5, 1.2) (2.5,1.3) (2.6, 0.4)}; 
    node [label={[label distance=-0.3cm, xshift=-2cm, fill=white]:$U_i$}] {};
    \draw[smooth cycle, pattern color=blue, pattern=crosshatch dots] 
        plot coordinates {(4, 0) (3.7, 0.8) (3.0, 1.2) (2.5, 1.2) (2.2, 0.8) (2.3, 0.5) (2.6, 0.3) (3.5, 0.0)}; node [label={[label distance=-0.8cm, xshift=.75cm, yshift=1cm, fill=white]:$U_j$}] {};

    % First Axis
    \draw[thick, ->] (-3,-5) -- (0, -5) node [label=above:$\phi_i(U_i)$] {};
    \draw[thick, ->] (-3,-5) -- (-3, -2) node [label=right:$\mathbb{R}^m$] {};

    % Arrow from i to j
    \draw[->] (0, -3.85) -- node[midway, above]{$\psi_{ij}$} (4.5, -3.85);

    % Second Axis
    \draw[thick, ->] (5, -5) -- (8, -5) node [label=above:$\phi_j(U_j)$] {};
    \draw[thick, ->] (5, -5) -- (5, -2) node [label=right:$\mathbb{R}^m$] {};

    % Sets in R^m
    \draw[white, pattern color=orange, pattern=crosshatch dots] (-0.67, -3.06) -- +(180:0.8) arc (180:270:0.8);
    \fill[even odd rule, white] [smooth cycle] plot coordinates{(-2, -4.5) (-2, -3.2) (-0.8, -3.2) (-0.8, -4.5)} (-0.67, -3.06) -- +(180:0.8) arc (180:270:0.8);
    \draw[smooth cycle] plot coordinates{(-2, -4.5) (-2, -3.2) (-0.8, -3.2) (-0.8, -4.5)};
    \draw (-1.45, -3.06) arc (180:270:0.8);

    \draw[white, pattern color=blue, pattern=crosshatch dots] (5.7, -3.06) -- +(-90:0.8) arc (-90:0:0.8);
    \fill[even odd rule, white] [smooth cycle] plot coordinates{(7, -4.5) (7, -3.2) (5.8, -3.2) (5.8, -4.5)} (5.7, -3.06) -- +(-90:0.8) arc (-90:0:0.8);
    \draw[smooth cycle] plot coordinates{(7, -4.5) (7, -3.2) (5.8, -3.2) (5.8, -4.5)};
    \draw (5.69, -3.85) arc (-90:0:0.8);

\end{tikzpicture}

\end{document}

I don't get anywhere near the figure I need to make.

Best Answer

Disclaimer: I don't even know if this is mathematically correct. However, you can make it "correcter" by changing the coordinates.

This is my best attempt to replicate your figure. The only key I used is "find the coordinates".

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[>=latex]
\coordinate (a) at (0,0);
\coordinate (b) at (4,0);
\coordinate (c) at (0,-3);
\draw (-2,-3) node[left] {$R^1$}--(2,-3) (0,-2.9)--(0,-3.1) node[below] {$f(P)$};
\draw[dashed,->,postaction={
    decorate,
    decoration={
        markings,
        mark=at position 0.6 with \coordinate (x);
    }
}] plot[smooth] coordinates {(b) (3,-1) (1,-2) (c)};
\draw (x) node[below right] {$f\circ g^{-1}$};
\draw[->,postaction={
    decorate,
    decoration={
        markings,
        mark=at position 0.6 with \coordinate (y);
    }
}] plot[smooth] coordinates {(a) (-.4,-.5) (-.1,-2) (c)};
\draw (y) node[left] {$f$};
\draw[thick,->,postaction={
    decorate,
    decoration={
        markings,
        mark=at position 0.6 with \coordinate (z);
    }
}] plot[smooth] coordinates {(a) (2,.25) (3.5,0) (b)};
\draw (z) node[above] {$g$};
\fill (a) circle (1.5pt) node[above right] {$P$} (b) circle (1.5pt) node[above] {$g(P)$};
\draw (-.1,.1) circle (0.8) ++(185:0.8) node[right] {$U$};
\draw[very thick,rounded corners=3mm] (-1.5,0)--(-1.3,.5)--(-.8,1.2)--(0,1)--(1.5,1.2)--(1.75,.5)--(0.875,-.7)--(0,-1)--(-1,-.8)--cycle;
\draw (-1.5,0) node[right] {$M$};
\draw (3.9,-.1) circle (0.8);
\draw[very thick] (3,1)--(5.5,1)--(5,-1.3)--(2.5,-1.3)--cycle;
\draw (5.5,1) node[below left] {$R^n$};
\draw[ultra thin] (4,-.5)--++(.2,-1) node[below] {$g(U)$};
\end{tikzpicture}
\end{document}

enter image description here

Related Question