1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| \documentclass{article} \usepackage{mwe,subcaption,tikz} \tikzset{boximg/.style={remember picture,red,thick,draw,inner sep=0pt,outer sep=0pt}}
\begin{document} \begin{figure} \centering %插入原图 \begin{subfigure}{.55\linewidth} \begin{tikzpicture}[boximg] \node[anchor=south west] (img) {\includegraphics[width=\linewidth]{example-image}}; \begin{scope}[x={(img.south east)},y={(img.north west)}] % 建立相对坐标系,辅助标注框定位 \draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1); \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; } \foreach \y in {1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; } \end{scope}
\begin{scope}[x=(img.south east),y=(img.north west)] \node[draw,minimum height=1.6cm,minimum width=1.00cm] (B1) at (0.2,0.60) {}; \node[draw,minimum height=0.8cm,minimum width=0.50cm] (B2) at (0.7,0.25) {}; \node[draw,minimum height=0.4cm,minimum width=0.25cm] (B3) at (0.9,0.10) {}; \end{scope} \end{tikzpicture} \caption{} \end{subfigure}\\[0.5\baselineskip] %插入图片局部放大图 \begin{subfigure}{.55\linewidth} \begin{tikzpicture}[boximg] \node (img1) {\includegraphics[width=0.3\linewidth]{example-image-10x16}}; \draw (img1.south west) rectangle (img1.north east); \end{tikzpicture}\hfill% \begin{tikzpicture}[boximg] \node (img2) {\includegraphics[width=0.3\linewidth]{example-image-10x16}}; \draw (img2.south west) rectangle (img2.north east); \end{tikzpicture}\hfill%
\begin{tikzpicture}[boximg] \node (img3) {\includegraphics[width=0.3\linewidth]{example-image-10x16}}; \draw (img3.south west) rectangle (img3.north east); end{tikzpicture} \caption{} \end{subfigure}
% 绘制连接性 \begin{tikzpicture}[overlay,boximg] \draw (B1) -- (img1); \draw (B2) -- (img2); \draw (B3) -- (img3); \end{tikzpicture} \caption{Connection to Subfigure} \end{figure} \end{document}
|