函数的复合怎样画?

函数的复合怎样画?

我想要绘制如下的函数组合图:

在此处输入图片描述

我当前使用的编码如下:

\documentclass{article}
\usepackage{xparse,tikz,amssymb}
\usetikzlibrary{positioning,calc}

\begin{document}    
    \begin{center}
        \begin{tikzpicture}[
        >=stealth,
        bullet/.style={
            fill=black,
            circle,
            minimum width=1pt,
            inner sep=1pt
        },
        projection/.style={
            ->,
            thick,
            shorten <=2pt,
            shorten >=2pt
        },
        every fit/.style={
            ellipse,
            draw,
            inner sep=0pt
        }
        ]
        
        \draw (0,2.5) ellipse (1.5cm and 2.5cm);
        \draw (4,2.5) ellipse (1.7cm and 2.5cm);
        \draw (7.5,2.5) ellipse (1.02cm and 2.5cm);
        \draw (10.4,2.5) ellipse (1.02cm and 2.5cm);
        \draw (-1,2.5) node[right]{$M_n\times M_n$};
        \draw (2.7,2.5) node[right]{$Row_i\times Row_i$};
        \draw (7.1,2.5) node[right]{$M_n$};
        \draw (9.8,2.5) node[right]{$M_{1\times n}$};
        \draw (12.2,2.5) node[right]{$\mathbb{R}$};
        \draw (11.8,2.5) node[above]{$\omega^*$};
        \draw (8.9,2.5) node[above]{$\omega'_{ij}$};
        \draw (6.1,2.5) node[above]{$\omega_{ij}$};
        \draw (1.9,2.5) node[above]{$R_i$};
        \node (END) at (12.7,2.8){};
        \node (START)   at (0,2.5){};
        \draw (6.1,-0.6) node[below]{$\succ$};
        
        \draw[projection] (1,2.5) -- (2.8,2.5);
        \draw[projection] (5.2,2.5) -- (7.2,2.5);
        \draw[projection] (8,2.5) -- (9.8,2.5);
        \draw[projection] (11,2.5) -- (12.3,2.5);
        \end{tikzpicture}
        \newline
    \end{center}
\end{document}

生成结果:

在此处输入图片描述

请帮助我。提前致谢。

答案1

在我看来,用等大小的圆代替椭圆会更好。使用tikz-cd(与薛定谔的猫答案中提出的类似),MWE 为:

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz-cd}

\begin{document}
    \[
\begin{tikzcd}[sep=small,
               cells={nodes={circle, draw, minimum size=7em, inner sep=1pt}}, 
               every arrow/.append style = {-stealth, bend left=60}
               every label/.append style = {font=\normalsize}
               ]
M_n\times M_n \ar[r,"R_i"]
              \ar[rrrr,bend right=40, "\succ" ']
    &   \mathrm{Row}_i\times\mathrm{Row}_i \ar[r,"\omega_{ij}"]
        &   M_n \ar[r,"\omega_{ij}'"]
            &   M_{1\times n} \ar[r,"\omega^*"]
                &   \mathbb{R}  \\  
\end{tikzcd}
    \]
\end{document}

在此处输入图片描述

答案2

也许可以用tikz-cd。我不确定这些省略号在这里是否有用,但这取决于你。

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz-cd}
\usetikzlibrary{shapes.geometric}
\begin{document}
\[\tikzcdset{del/.style={end anchor=90+#1,start anchor=90-#1},
del/.default=2}
\begin{tikzcd}[cells={nodes={ellipse,minimum height=12em,draw}},
    bend angle=50,every arrow/.append style={-stealth}]
 M_n\times M_n \arrow[r,bend left,"R_i",del=5]
 \arrow[rrrr,bend right=30,"\succ",end anchor=-95,start anchor=-85]
 &  \mathrm{Row}_i\times \mathrm{Row}_i \arrow[r,bend left,"\omega_{ij}",del]
 & M_n \arrow[r,bend left,"\omega_{ij}'",del]
 & M_{1\times n} \arrow[r,bend left,"\omega^*",del]
 & \mathbb{R}\\
\end{tikzcd}
\]
\end{document}

在此处输入图片描述

正如我所说,椭圆在这里可能不是最佳选择。因此,这里是适当大小的阴影圆。

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[cells={nodes={circle,align=center,inner sep=1pt,
    text width={width("$\mathrm{Row}_i\times\mathrm{Row}_i$")},draw,
    path picture={\path[ball color=gray!60,fill opacity=0.4]
     (path picture bounding box.center) 
     circle[radius={width("$\mathrm{Row}_i\times\mathrm{Row}_i$")*1pt}];
    }}},
    bend angle=50,every arrow/.append style={-stealth,bend left},
    every label/.append style={font=\normalsize},
    sep=small]
 M_n\times M_n \arrow[r,"R_i"]
 \arrow[rrrr,bend right=25,"\succ",start anchor=-60,end anchor=-120]
 &  \mathrm{Row}_i\times \mathrm{Row}_i \arrow[r,"\omega_{ij}"]
 & M_n \arrow[r,"\omega_{ij}'"]
 & M_{1\times n} \arrow[r,"\omega^*"l]
 & \mathbb{R}\\
\end{tikzcd}
\]
\end{document}

在此处输入图片描述

答案3

我不知道这个包tikz-cd。让我们看看我们能用 TikZ 做什么。

步骤1 :

接下来的最小代码就足以绘制你想要的东西

\documentclass[border=.25cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric }
\begin{document}
\begin{tikzpicture}
\foreach \i in {1,...,5}{%
\node[draw,ellipse,minimum height=3cm, minimum width=2cm] (E\i) at (2.5*\i,0)  {};}
\draw[->] (E1.north) to[bend left=45]  node[auto] {$R$} (E2.north);
\draw[->] (E1.south) to[bend right=45] node[auto] {$>$} (E5.south);
\end{tikzpicture}

\end{document}

在此处输入图片描述

第2步 :

\documentclass[border=.25cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric }
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}
\foreach \i/\content in {1/$M_n\times M_n$,2/$Row_i\times Row_i$,3/$M_n$,4/$M_{1\times n}$,5/$\mathbb{R}$}{%
\node[draw,ellipse,minimum height=3cm, minimum width=1cm] (E\i) at (4*\i,0)  {\content };}
\draw[->] (E1.north) to[bend left=45]  node[auto] {$R$} (E2.north);
\draw[->] (E1.south) to[bend right=45] node[auto] {$>$} (E5.south);
\end{tikzpicture}

\end{document}

在此处输入图片描述

最后一步:

\documentclass[border=.25cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric }
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}
\foreach \i/\content in {1/$M_n\times M_n$,2/$Row_i\times Row_i$,3/$M_n$,4/$M_{1\times n}$,5/$\mathbb{R}$}{%
\node[draw,ellipse,minimum height=3cm, minimum width=.8cm] (E\i) at (3.2*\i,0)  {\content };}
\foreach \i/\lb [count=\j from 2] in {1/$R_i$,2/$\omega_{ij}$,3/$\omega_{ij}'$,4/$\omega^*$}{%
\draw[->] (E\i.north) to[bend left=45]  node[auto] {\lb} (E\j.north);}
 \draw[->] (E1.south) to[bend right=45] node[auto] {$>$} (E5.south);
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容