如何才能画出从一个轴上的点到另一个轴上的点的箭头?

如何才能画出从一个轴上的点到另一个轴上的点的箭头?

我创建了这段代码,它开始说明流形中某个点周围的邻域如何映射到平面上的某个区域:

\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\pgfplotsset{compat=1.12}
\begin{document}
    \begin{tikzpicture}
            \begin{axis}[
                    name=mfd,
                    declare function={
                            f(\x,\y)=10-(\x^2+\y^2);
                    },
                    declare function={
                            c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
                    },
                    declare function={
                            c_y(\t)=(sin(\t))/2-1;
                    },
                    declare function={
                            c_z(\t)=f(c_x(\t),c_y(\t));
                    },
            ]
                    \addplot3[surf,domain=-2:2,domain y=-2:2,]{f(x,y)};
                    \addplot3[black,opacity=1.0,variable=t,domain=0:360,dashed,thin] ({c_x(t)},{c_y(t)},{c_z(t)});
                    \addplot3[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1,{f(1,-1)});
            \end{axis}
            \begin{axis}[
                    at={($(mfd.north east)+(1cm,-5cm)$)},
                    anchor=north west,
                    declare function={
                            c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
                    },
                    declare function={
                            c_y(\t)=(sin(\t))/2-1;
                    }
            ]
                    \addplot[variable=t,domain=0:360]({c_x(t)},{c_y(t)});
                    \addplot[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1);
            \end{axis}
    \end{tikzpicture}
\end{document}

但是,我很难找到最佳方法,从 3D 表面上的(拓扑)圆中间的点到平面上的相应点绘制箭头,因为它们处于不同的轴环境中。有什么好方法可以做到这一点吗?

答案1

在每个图的末尾添加coordinate,然后在第二个 后画一个正常箭头axis在此处输入图片描述

\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\pgfplotsset{compat=1.12}
\begin{document}
    \begin{tikzpicture}
            \begin{axis}[
                    name=mfd,
                    declare function={
                            f(\x,\y)=10-(\x^2+\y^2);
                    },
                    declare function={
                            c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
                    },
                    declare function={
                            c_y(\t)=(sin(\t))/2-1;
                    },
                    declare function={
                            c_z(\t)=f(c_x(\t),c_y(\t));
                    },
            ]
                    \addplot3[surf,domain=-2:2,domain y=-2:2,]{f(x,y)};
                    \addplot3[black,opacity=1.0,variable=t,domain=0:360,dashed,thin] ({c_x(t)},{c_y(t)},{c_z(t)});
                    \addplot3[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1,{f(1,-1)}) coordinate (a);
            \end{axis}
            \begin{axis}[
                    at={($(mfd.north east)+(1cm,-5cm)$)},
                    anchor=north west,
                    declare function={
                            c_x(\t)=(cos(\t)+(sin(5*\t)/10))/3+1;
                    },
                    declare function={
                            c_y(\t)=(sin(\t))/2-1;
                    }
            ]
                    \addplot[variable=t,domain=0:360]({c_x(t)},{c_y(t)});
                    \addplot[black,opacity=1.0,only marks,mark=text,text mark=$\cdot$] (1,-1) coordinate (b);
            \end{axis}

\draw [-stealth,shorten <=3pt,shorten >=3pt] (a) to[bend left] (b);
    \end{tikzpicture}
\end{document}

相关内容