答案1
也许像这样
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node
[fill=blue!20, shape=rectangle, minimum height=1cm, minimum width=3cm]
(A){dataset};
\draw (5,0) node
[fill=yellow!20, shape=rectangle, minimum height=1cm, minimum width=3cm]
(B){};
\draw (7,3) node
[fill=red!20, shape=circle, minimum width=30]
(C){};
\draw[line width=2pt] (A) -- (B);
\draw [line width=2pt,->] (B) -- (C);
\end{tikzpicture}
\end{document}
答案2
如果使用相对定位而不是绝对定位,则以后修改代码会更容易。on grid
放置有助于保持整洁。shapes.geometric
提供diamond
形状和样式以保持格式一致。arrows.meta
提供增强的箭头提示和graphs
库使绘制连接变得更容易。shadows.blur
是为了令人震惊的金光闪闪。
\documentclass[border=10pt,multi,tikz,dvipsnames,svgnames,rgb]{standalone}
\usetikzlibrary{shapes.geometric,arrows.meta,positioning,graphs,shadows.blur}
\begin{document}
\begin{tikzpicture}
[
>=Latex,
thick,
base/.style={draw=#1!50, fill=#1!20, font=\sffamily, text opacity=1, on grid, node distance=20mm, blur shadow},
my diamond/.style={base=green, aspect=7.5, diamond, minimum height=10mm},
block/.style={base=blue, minimum width=20mm, minimum height=10mm},
my circle/.style={base=red, circle, minimum size=10mm},
]
\node (ds) [block] {DATASET};
\node (c1) [my circle, above right=of ds] {};
\node (dia) [my diamond, above right=of c1] {};
\node (c2) [my circle, below right=of dia] {};
\node (blk) [block, below right=of c2] {};
\graph [use existing nodes] {
ds -- c1 -> dia -- c2 -> blk
};
\end{tikzpicture}
\end{document}