答案1
前段时间我用 做过这件事matrix
。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning, matrix}
\begin{document}
\begin{tikzpicture}[font=\sffamily\small,
llista/.style={matrix of nodes,
row sep =-\pgflinewidth,
column sep=-\pgflinewidth,
outer sep=0pt,
nodes={draw=none}
},
proces/.style={llista,
inner sep=0pt,
nodes={draw, rectangle, minimum height=5mm, minimum width=5mm,
outer sep=0pt, anchor=center, fill=blue!15},
row 1/.style={nodes={draw=none,fill=none}}
},
]
\node[proces](A){
7 & & 0 & & 1 & & 2 & & 0 & & 3 & & 0 & & 4 & & 2 & & 3 & & 0 & & 3 & & 2 & & 1 & & 2 & & 0 & & 1 & & 7 & & 0 & & 1 & \\
& 7 & & 7 & & 7 & & 2 & & & & 2 & & & & 4 & & 4 & & 4 & & 0 & & & & & & 1 & & & & 1& & & & 1 & \\
& ~ & & 0 & & 0 & & 0 & & & & 0 & & & & 0 & & 0 & & 3 & & 3 & & & & & & 3 & & & & 0& & & & 0 & \\
& ~ & & ~ & & 1 & & 1 & & & & 3 & & & & 3 & & 2 & & 2 & & 2 & & & & & & 2 & & & & 2& & & & 7 & \\
};
\end{tikzpicture}
\end{document}