答案1
您可以使用\nodepart
。
这是图像的开头,我把其余部分留给你作为练习。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}
\begin{document}
\begin{tikzpicture}
\node[name=artista, rectangle split, rectangle split parts=6, draw, rectangle split draw splits=false, align=center]
{ Artist A
\nodepart{two} User 1: 74 plays
\nodepart{three} User 2: 32 plays
\nodepart{four} User 3: 0 plays
\nodepart{five} $\vdots$
\nodepart{six} User \emph{n}: 67 plays
};
\draw (artista.text split west) -- (artista.text split east);
\node[rectangle,draw, right = of artista] (bm251) {BM25};
\draw [red] (artista.two east) -- (bm251.west);
\draw [red] (artista.three east) -- (bm251.west);
\draw [red] (artista.four east) -- (bm251.west);
\draw [red] (artista.six east) -- (bm251.west);
\node[name=artistb, rectangle split, rectangle split parts=6, draw, rectangle split draw splits=false, align=center, below = of artista]
{ Artist B
\nodepart{two} User 1: 95 plays
\nodepart{three} User 2: 0 plays
\nodepart{four} User 3: 129 plays
\nodepart{five} $\vdots$
\nodepart{six} User \emph{n}: 56 plays
};
\draw (artistb.text split west) -- (artistb.text split east);
\node[rectangle,draw, right = of artistb] (bm252) {BM25};
\draw [red] (artistb.two east) -- (bm252.west);
\draw [red] (artistb.three east) -- (bm252.west);
\draw [red] (artistb.four east) -- (bm252.west);
\draw [red] (artistb.six east) -- (bm252.west);
\node[green, draw, thick, text width=50pt, font={\tiny\bfseries}, text=black, below =9ex of bm251](between12) {Each user\\ receive a score\\ from the BM25\\ function};
\draw[->, green] (between12) -- (bm251);
\draw[->, green] (between12) -- (bm252);
\end{tikzpicture}
\end{document}
答案2
有matrix
,基于/转换自车牌回答:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[BM/.style = {%Big Matrix
matrix of nodes, draw, inner sep=0pt,
nodes={minimum width=#1, inner sep=1mm}
},
node distance = 6mm and 12mm
]
\matrix (m11) [BM=19ex]
{ Artist A \\
User 1: 74 plays \\
User 2: 32 plays \\
User 3: 0 plays \\
$\vdots$ \\
User \emph{n}: 67 plays \\
};
\draw (m11-1-1.south west) -- (m11-1-1.south east);
%
\node (bm25a) [rectangle, draw, right = of m11] {BM25};
\draw[red] (m11-2-1.east) -- (bm25a.west)
(m11-3-1.east) -- (bm25a.west)
(m11-4-1.east) -- (bm25a.west)
(m11-6-1.east) -- (bm25a.west);
%
\matrix (m12) [BM=24ex, right=of bm25a]
{ Artist A (BM25 score) \\
User 1: 10.54 \\
User 2: 12.81 \\
User 3: \,\ 3.79 \\
$\vdots$ \\
User \emph{n}: 11.67 \\
};
\draw (m12-1-1.south west) -- (m12-1-1.south east);
%
\draw[red,->] (bm25a) -- (m12);
%%%% second row with matrces
\matrix (m21) [BM=19ex, below=of m11]
{ Artist B \\
User 1: 95 plays \\
User 2: 0 plays \\
User 3: 129 plays \\
$\vdots$ \\
User \emph{n}: 56 plays \\
};
\draw (m21-1-1.south west) -- (m21-1-1.south east);
%
\node (bm25b) [rectangle,draw, right = of m21] {BM25};
\draw[red] (m21-2-1.east) -- (bm25b.west)
(m21-3-1.east) -- (bm25b.west)
(m21-4-1.east) -- (bm25b.west)
(m21-6-1.east) -- (bm25b.west);
%%%%
\path(bm25a) -- node (between12) [draw=green, thick,
align=left,
font=\scriptsize\bfseries] {Each user\\ receive a score\\
from the BM25\\ function}
(bm25b);
\draw[->, green] (between12) -- (bm25a);
\draw[->, green] (between12) -- (bm25b);
\end{tikzpicture}
\end{document}