这可能很简单,但对我来说却是一项艰巨的任务。以下是我在谷歌绘图中粗略绘制的流程图的一部分。气泡(实际上是点)表示有连续的帧。 如何在 tikz 中绘制它?块形状的蓝色选择是任意的。
答案1
无论多么简单,请尝试包含 MWE。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric}
\begin{document}
%
%
\begin{center}
\begin{tikzpicture}
\node[draw] (topnode) at (3,2) {Node A};
\node[draw] (botnode) at (3,-2) {Node B};
\foreach\x in {1,...,5}{
\node[draw,trapezium,trapezium left angle=120, trapezium right angle=60pt] (innernode\x)at (\x,0) {\x};
\draw (innernode\x) |- ($(innernode\x)!0.5!(topnode)$) -| (topnode);
\draw (innernode\x) |- ($(innernode\x)!0.5!(botnode)$) -| (botnode);
}
\end{tikzpicture}
\end{center}
%
%
\end{document}
答案2
这里有很多选项;我使用了matrix
。我也没有在下面的代码中过多地阐述。例如,如果您需要计算线之间的交点,则必须使用库intersections
。您也可以查看 PGF 手册,它有很多示例。
\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\usetikzlibrary{shapes.geometric}
\usepackage{mathtools,ellipsis}
\begin{document}
\begin{tikzpicture}[%
any/.style={%
draw,
shape=trapezium,
trapezium left angle=60, trapezium right angle=120pt,
fill=blue!50,
minimum size=0.5cm,
},
topper/.style={%
any,
shape=rectangle,
},
]
\matrix (somematrix) [%
matrix of nodes,
nodes=any,
column sep=0.5cm,
row sep=0.5cm,
]
{%
& |[topper] (n1)| Node A & & \\
|(n2)| Frame 1 & |(n3)| Frame 2 & |[draw=none,fill=none]| $\cdots$ & |(n4)| Frame N \\
& |[topper](n5)| Node B & & \\
};
\draw (n1) -- (n3) -- (n5)
(n2) |- ++(0,0.5) -| (n4)
(n2) |- ++(0,-0.5) -| (n4);
\end{tikzpicture}
\end{document}
答案3
经过一番摆弄,我终于让我的代码运行起来了(我是提问者)
\documentclass[tikz,border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric}
\begin{document}
%
%
\tikzset{
block/.style = {rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em},
data/.style = {draw,trapezium,trapezium left angle=70,trapezium right angle=-70,minimum height=3em,fill=blue!20}
}
%
%
\begin{tikzpicture}[]
\node [block] (nodeA) {Node A};
\node [below of=nodeA] (spreadout) {};
\matrix[
row sep=0.3cm,column sep=0.5cm, below of=spreadout] (framematrix) {
\node[data] (frame1){ Frame 1};&
\node[data] (frame2){ Frame 2};&
\node (dots1) {$\ldots$};&
\node (dots1) {$\ldots$};&
\node (dots1) {$\ldots$};&
\node[data] (frameN){ Frame N};\\
};
\node [below of=framematrix] (spreadin) {};
\node [block,below of=spreadin] (nodeB) {nodeB};
\path [draw] (nodeA) --(spreadout);
\path [draw] (spreadout.north) -| (frame1);
\path [draw] (spreadout.north) -| (frame2);
\path [draw] (spreadout.north) -| (frameN);
\path [draw] (frame1) |- (spreadin.north);
\path [draw] (frame2) |- (spreadin.north);
\path [draw] (frameN) |- (spreadin.north);
\path [draw] (spreadin.north) -- (nodeB);
\end{tikzpicture}
\end{document}