这段代码给了我下图。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{float}
\usepackage{subfig}
\usepackage{tikz}
\title{test}
\author{test}%
\date{January 2022}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\textwidth,trim={0 0 0 0},clip]{example-image-a}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw [-stealth, thick] (0.75,0.9) -- (0.75,-1);
\end{scope}
\end{tikzpicture}}\\
\subfloat{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\textwidth,trim={0 0 0 0},clip]{example-image-a}};
\end{tikzpicture}}
\caption{}
\label{fig:ablation}
\end{figure}
\end{document}
我希望箭头绘制在另一幅图像上,而不是像这样将其推开
我如何在多个 tikzpictures 上声明 tikzpicture?
答案1
这是一种覆盖的方法:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{float}
\usepackage{subfig}
\title{test}
\author{test}%
\date{January 2022}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\subfloat{
\begin{tikzpicture}[remember picture]
\node[inner sep=0pt] (image1) at (0,0) {\includegraphics[width=\textwidth,trim={0 0 0 0},clip]{example-image-a}};
\end{tikzpicture}}\\
\subfloat{
\begin{tikzpicture}[remember picture]
\node[inner sep=0pt] (image2) at (0,0) {\includegraphics[width=\textwidth,trim={0 0 0 0},clip]{example-image-a}};
\end{tikzpicture}}
\begin{tikzpicture}[overlay,remember picture]
\begin{scope}
\draw [-stealth, ultra thick,] ($(image1.east)+(-1.25,0)$)--($(image2.east)+(-1.25,0)$);
\end{scope}
\end{tikzpicture}
\caption{}
\label{fig:ablation}
\end{figure}
\end{document}
请随意将“shifts”更改为您喜欢的值
输出: