我想创建一个像下面附图中的流程图,其中包含图片。我该怎么做?
答案1
更新
如果细蓝线代表放大图像,则spy
可以使用该库:
代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta,spy}
\definecolor{arrowblue}{RGB}{98,145,224}
\newcommand\ImageNode[3][]{
\node[draw=arrowblue!80!black,line width=1pt,#1] (#2) {\includegraphics[width=1.5cm,height=1.5cm]{#3}};
}
\begin{document}
\begin{tikzpicture}[
spy using outlines={
magnification=4,
size=1.5cm,
connect spies
},
node distance=1.5cm,
>={Triangle[angle=60:1pt 2]},
shorten >= 2pt,
shorten <= 2pt,
arrow/.style={
->,
arrowblue,
line width=5pt
},
aux/.style={
text width=1.5cm,
minimum height=1.75cm,
draw=arrowblue!80!black,
line width=1pt
}
]
\ImageNode[label={-90:text}]{A}{example-image-a}
\node[right=of A,aux,label={270:text}] (B) {};
\spy[arrowblue] on ([shift={(0,-10pt)}]C) in node at (B) {};
\ImageNode[label={180:text},above right=of B]{C}{example-image-c}
\ImageNode[label={0:text},below right=of C]{D}{example-image}
\ImageNode[label={180:text},below left=of D]{E}{example-grid-100x100bp}
\node[right=of E,aux,label={0:text}] (F) {};
\spy[arrowblue] on ([shift={(10pt,0pt)}]E) in node at (F) {};
\node[below=of E,aux,label={270:text}] (G) {};
\spy[arrowblue] on ([shift={(0pt,10pt)}]E) in node at (G) {};
\ImageNode[left=of G]{H}{example-image}
\ImageNode[right=of G]{I}{example-image-a}
\draw[arrow]
(A) -- node[above,text=black] {text} (B);
\draw[arrow]
(C) -- (D);
\draw[arrow]
(D) -- (E);
\draw[arrow]
(G) -- (H);
\draw[arrow]
(G) -- (I);
\end{tikzpicture}
\end{document}
初始版本
一种选择:
代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\definecolor{arrowblue}{RGB}{98,145,224}
\newcommand\ImageNode[3][]{
\node[draw=arrowblue!80!black,line width=1pt,#1] (#2) {\includegraphics[width=1.5cm,height=1.5cm]{#3}};
}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm,
>={Triangle[angle=60:1pt 2]},
shorten >= 2pt,
shorten <= 2pt,
arrow/.style={
->,
arrowblue,
line width=5pt
}
]
\ImageNode[label={-90:text}]{A}{example-image-a}
\ImageNode[label={-90:text},right=of A]{B}{example-image-b}
\ImageNode[label={180:text},above right=of B]{C}{example-image-c}
\ImageNode[label={0:text},below right=of C]{D}{example-image}
\ImageNode[label={180:text},below left=of D]{E}{example-image-a}
\ImageNode[label={0:text},right=of E]{F}{example-image-b}
\ImageNode[label={-90:text},below=of E]{G}{example-image-c}
\ImageNode[left=of G]{H}{example-image}
\ImageNode[right=of G]{I}{example-image-a}
\draw[arrow]
(A) -- (B);
\draw[arrow]
(C) -- (D);
\draw[arrow]
(D) -- (E);
\draw[arrow]
(G) -- (H);
\draw[arrow]
(G) -- (I);
\end{tikzpicture}
\end{document}
\node
使用命令包含图像
\ImageNode[<node options>]{<node name>}{<image file>}