在图中画箭头

在图中画箭头

我试图从最后一行蓝色线条到幻灯片底部的图形绘制一条线。但是,\path (4,1)坐标 ( mat);不遵循帮助网格。

这是我的代码:

% This example requires PGF >= 1.09 and only works wit PDFTeX
% You have to compile document twice to get correct placement of nodes.
\documentclass{beamer} %
\usepackage{tikz}
\usepackage{verbatim}

\usetikzlibrary{arrows,shapes,backgrounds} 
\usepackage{tikzpagenodes} 


\begin{document}


% For every picture that defines or uses external nodes, you'll have to
% apply the 'remember picture' style. To avoid some typing, we'll apply
% the style to all pictures.
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]

\begin{frame}{contour}
\begin{columns}
\begin{column}{0.6\paperwidth}
% define source coordinates
\begin{itemize}
\item You can make surfaces two-dimensional by using contour

{\scriptsize{\fontseries{b}\texttt{\textcolor{blue}{ 
>> contour(X,Y,Z,\lq LineWidth',2)}}}}\tikz[na] \coordinate (s-gray); 
\begin{itemize}
\item takes same arguments as surf
\item color indicates height
\item can modify linestyle properties
\item can set colormap
\end{itemize}

{\scriptsize{\fontseries{b}\texttt{\textcolor{blue}{ 
>> hold on\\
>> mesh(X,Y,Z)\tikz[na] \coordinate (s-mat);\\
}}}}
\end{itemize}
\end{column}

\begin{column}{0.4\paperwidth}
\tikzstyle{background grid}=[draw, black!50,step=.5cm]
\begin{tikzpicture}%[show background grid]

\node [inner sep=0pt,above right,xshift=0]{\includegraphics[width=4.5cm]{fig15}};
% show origin
%\fill (0,0) circle (2pt);
\path (0,3.2) coordinate (gray);

% define destination coordinates
\end{tikzpicture}
\end{column}
\end{columns}
\tikzstyle{background grid}=[draw, black!50,step=.5cm]

\begin{tikzpicture}[show background grid]
\path (4,1) coordinate (mat);

  \node [inner sep=0pt,xshift=8cm ] {\includegraphics[width=5.5 cm]{fig16}};
                            %\fill (0,0) circle (2pt);
\end{tikzpicture}
% define overlays
% Note the use of the overlay option. This is required when 
% you want to access nodes in different pictures.
\begin{tikzpicture}[overlay]

        \path[->,black,thick] (s-mat) edge  (mat);
    \path[->,black,thick] (s-gray) edge  (gray);

\end{tikzpicture}
\end{frame}




\end{document}

答案1

我不确定mat坐标试图做什么,但您可以为节点指定一个名称,以便更容易绘制箭头。

输出

图1

代码

\documentclass{beamer} %
\usepackage{tikz}
\usepackage{verbatim}
\usepackage{lmodern}
\usetikzlibrary{arrows,shapes,backgrounds} 
\usepackage{tikzpagenodes} 

\tikzset{
    every picture/.style={remember picture},
    na/.style={baseline=-.5ex},
    background grid/.style={draw, black!50,step=.5cm}
}


\begin{document}
\begin{frame}{contour}
\begin{columns}
\begin{column}{0.6\paperwidth}
% define source coordinates
\begin{itemize}
\item You can make surfaces two-dimensional by using contour

{\scriptsize{\fontseries{b}\texttt{\textcolor{blue}{ 
>> contour(X,Y,Z,\lq LineWidth',2)}}}}\tikz[na] \coordinate (s-gray); 
\begin{itemize}
\item takes same arguments as surf
\item color indicates height
\item can modify linestyle properties
\item can set colormap
\end{itemize}

{\scriptsize{\fontseries{b}\texttt{\textcolor{blue}{ 
>> hold on\\
>> mesh(X,Y,Z)\tikz[na] \coordinate (s-mat);\\
}}}}
\end{itemize}
\end{column}

\begin{column}{0.4\paperwidth}
\begin{tikzpicture}%[show background grid]

\node [inner sep=0pt,above right,xshift=0](a){\includegraphics[width=4.5cm]{example-image-a}};
\path (0,3.2) coordinate (gray);

\end{tikzpicture}
\end{column}
\end{columns}
\tikzstyle{background grid}=[draw, black!50,step=.5cm]
\begin{figure}
\centering
\begin{tikzpicture}
\node [inner sep=0pt] (b) {\includegraphics[width=5.5 cm]{example-image-b}};
\end{tikzpicture}
\end{figure}
\begin{tikzpicture}[overlay]

\draw[->,black,thick] (s-mat) -| (b.north);
\draw[->,black,thick] (s-gray) -- (a);

\end{tikzpicture}
\end{frame}
\end{document}

相关内容