流形上的转换图

流形上的转换图

在此处输入图片描述

我正在尝试使用以下答案制作此 tikzpicture在 tikz 中绘制流形 但我无法将 U 和 V 的交点设为灰色。如果我将 U 和 V 设为白色,那么交点也会是白色。我的问题是如何将交点设为灰色,而将其他部分设为白色?

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


\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}

% Functions i
\path[->] (0.8, 0) edge [bend right] node[left, xshift=-2mm] {$\varphi$} (-1, -2.9);
\draw[white,fill=white] (0.06,-0.57) circle (.15cm);

% Functions j
\path[->] (4.2, 0) edge [bend left] node[right, xshift=2mm] {$\psi$} (6.2, -2.8);
\draw[white, fill=white] (4.54,-0.12) circle (.15cm);

% Manifold
\draw[smooth cycle] 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, dashed] 
    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$}] {};
\draw[smooth cycle, dashed] 
    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]:$V$}] {};

% First Axis
\draw[thick, ->] (-3,-5) -- (0, -5)  {};
\draw[thick, ->] (-3,-5) -- (-3, -2)  {};

% Arrow from i to j
\path[->] (0, -3.85) edge [bend left]  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] (-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, dashed] plot coordinates{(-2, -4.5) (-2, -3.2) (-0.8, -3.2) (-0.8, -4.5)};
\draw [dashed] (-1.45, -3.06) arc (180:270:0.8);

\draw[white] (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{figure}
\end{document}

答案1

您可以使用 \clip 命令来剪辑所有后续绘图。这就是它的工作原理。请注意,我已删除所有不必要的包。

    \documentclass[border=5mm]{standalone}
    \usepackage {tikz}
    \usepackage{amssymb}
    
    \begin{document}
    \begin{tikzpicture}
    
    % Functions i
    \path[->] (0.8, 0) edge [bend right] node[left, xshift=-2mm] {$\varphi$} (-1, -2.9);
    \draw[white,fill=white] (0.06,-0.57) circle (.15cm);
    
    % Functions j
    \path[->] (4.2, 0) edge [bend left] node[right, xshift=2mm] {$\psi$} (6.2, -2.8);
    \draw[white, fill=white] (4.54,-0.12) circle (.15cm);
    
    % Manifold
    \draw[smooth cycle] plot coordinates{(2,2) (-0.5,0) (3,-2) (5,1)} node at (3,2.3) {$M$};
    
    % Subsets
    \begin{scope}
        \clip[smooth cycle] plot coordinates {(1,0) (1.5, 1.2) (2.5,1.3) (2.6, 0.4)};
        \fill[gray!50, smooth cycle] 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)};
    \end{scope}
    \draw[dashed, smooth cycle] 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$}] {};
    \draw[dashed, smooth cycle] 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]:$V$}] {};
        
    % First Axis
    \draw[thick, ->] (-3,-5) -- (0, -5)  {};
    \draw[thick, ->] (-3,-5) -- (-3, -2)  {};
    
    % Arrow from i to j
    \path[->] (0, -3.85) edge [bend left]  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
\begin{scope}
    \clip [smooth cycle] plot coordinates{(-2, -4.5) (-2, -3.2) (-0.8, -3.2) (-0.8, -4.5)};
    \draw[fill=gray!50, dashed] (-0.8, -3.2) circle (0.8);
\end{scope}
\draw [smooth cycle, dashed] plot coordinates{(-2, -4.5) (-2, -3.2) (-0.8, -3.2) (-0.8, -4.5)};
    
\begin{scope}
    \clip [smooth cycle] plot coordinates{(7, -4.5) (7, -3.2) (5.8, -3.2) (5.8, -4.5)};
    \draw[fill=gray!50, dashed] (5.8, -3.2) circle (0.8);
\end{scope}
\draw[smooth cycle,dashed] plot coordinates{(7, -4.5) (7, -3.2) (5.8, -3.2) (5.8, -4.5)};
\end{tikzpicture}
    
\end{document}

在此处输入图片描述

相关内容