Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass[11pt]{article}
- \usepackage[french]{babel}
- \usepackage[utf8]{inputenc}
- \usepackage[T1]{fontenc}
- \usepackage{standalone}
- \usepackage{tikz}
- \usetikzlibrary{matrix}
- \usetikzlibrary{calc}
- \begin{document}
- \begin{tikzpicture}
- \def\S{4mm}
- \def\N{5mm}
- % dataframe
- \matrix (m) [matrix of math nodes, row sep=1em, column sep=1em] {
- & A & B & C & D \\
- 0 & A_0 & B_0 & C_0 & D_0 \\
- 1 & A_1 & B_1 & C_1 & D_1 \\
- 2 & A_2 & B_2 & C_2 & D_2 \\
- 3 & A_3 & B_3 & C_3 & D_3 \\
- \vdots &\vdots &\vdots &\vdots & \vdots \\
- n & A_n & B_n & C_n & D_n \\
- };
- \path let
- \p1 = ($(m-1-2)!0.5!(m-1-5)+(0,2em)$)
- in node at (\p1) {Dataframe};
- % index at the bottom
- \draw[->] let
- \p1 = ($(m-7-1)-(0,\S)$),
- \p2 = ($(\p1) -(0,\N)$)
- in (\p2) -- (\p1) node[below] (INDEX) at (\p2) {Index};
- % column dotted rectangle
- \draw[dotted] let
- \p1 = ($(m-7-3)-(\S,\S)$),
- \p2 = ($(m-2-3)+(\S,\S)$)
- in (\p1) rectangle (\p2);
- % row dotted rectangle
- \draw[dotted] let
- \p1 = ($(m-5-2)-(\S,\S)$),
- \p2 = ($(m-3-5)+(\S,\S)$),
- \p3 = ($(\x2,\y1)!0.5!(\x2,\y2)$)
- in (\p1) rectangle (\p2) coordinate (RSSP) at (\p3);
- % row slicing/selection table
- \draw[->] let
- \p1 = ($(RSSP)+(\N,0)$)
- in (RSSP) -- (\p1) node[right,anchor=west] (RSS) at (\p1) {Row Slicing/Selection};
- \draw[->] let
- \p1 = (RSS.south),
- \p2 = ($(\p1)-(0,\N)$)
- in (\p1) -- (\p2) coordinate[below] (RSST) at (\p2);
- \begin{scope}[shift=($(RSST)$),xshift=-3.5em,anchor=north west]
- \matrix (m) [matrix of math nodes, row sep=1em, column sep=1em] {
- 1 & A_1 & B_1 & C_1 & D_1 \\
- 2 & A_2 & B_2 & C_2 & D_2 \\
- 3 & A_3 & B_3 & C_3 & D_3 \\
- };
- \end{scope}
- % column slicing/selection table
- \draw[<-] let
- \p1 = ($(m-7-3)-(0,\S)$),
- \p2 = (INDEX),
- \p3 = ($(\x1,\y2)+(1em,0)$)
- in (\p1) |- (\p3) node[right,anchor=west] (CSS) at (\p3) {Column Slicing/Selection};
- \draw[<-] let
- \p1 = (CSS.south),
- \p2 = ($(\p1)-(0,\N)$)
- in (\p1) -- (\p2) coordinate[below] (CSST) at (\p2);
- \begin{scope}[shift=($(CSST)$),xshift=-3.5em,anchor=north west]
- \matrix (m) [matrix of math nodes, row sep=1em, column sep=1em] {
- 0 & B_0\\
- 1 & B_1\\
- 2 & B_2\\
- 3 & B_3\\
- \vdots & \vdots\\
- n & B_n\\
- };
- \end{scope}
- \end{tikzpicture}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement