Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 2.74 KB | None | 0 0
  1. \documentclass[11pt]{article}
  2. \usepackage[french]{babel}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage[T1]{fontenc}
  5. \usepackage{standalone}
  6. \usepackage{tikz}
  7.  
  8. \usetikzlibrary{matrix}
  9. \usetikzlibrary{calc}
  10.  
  11. \begin{document}
  12. \begin{tikzpicture}
  13.    \def\S{4mm}
  14.    \def\N{5mm}
  15.  
  16.     % dataframe
  17.     \matrix (m) [matrix of math nodes, row sep=1em, column sep=1em] {
  18.               & A     & B     & C     & D      \\
  19.        0      & A_0   & B_0   & C_0   & D_0    \\
  20.        1      & A_1   & B_1   & C_1   & D_1    \\
  21.        2      & A_2   & B_2   & C_2   & D_2    \\
  22.        3      & A_3   & B_3   & C_3   & D_3    \\
  23.        \vdots &\vdots &\vdots &\vdots & \vdots \\
  24.        n      & A_n   & B_n   & C_n   & D_n    \\
  25.    };
  26.    
  27.    \path let
  28.        \p1 = ($(m-1-2)!0.5!(m-1-5)+(0,2em)$)
  29.    in node at (\p1) {Dataframe};
  30.  
  31.     % index at the bottom
  32.     \draw[->] let
  33.         \p1 = ($(m-7-1)-(0,\S)$),
  34.         \p2 = ($(\p1)  -(0,\N)$)
  35.     in (\p2) -- (\p1) node[below] (INDEX) at (\p2) {Index};
  36.    
  37.     % column dotted rectangle
  38.     \draw[dotted] let
  39.         \p1 = ($(m-7-3)-(\S,\S)$),
  40.         \p2 = ($(m-2-3)+(\S,\S)$)
  41.     in (\p1) rectangle (\p2);
  42.  
  43.     % row dotted rectangle
  44.     \draw[dotted] let
  45.         \p1 = ($(m-5-2)-(\S,\S)$),
  46.         \p2 = ($(m-3-5)+(\S,\S)$),
  47.         \p3 = ($(\x2,\y1)!0.5!(\x2,\y2)$)
  48.     in (\p1) rectangle (\p2) coordinate (RSSP) at (\p3);
  49.  
  50.     % row slicing/selection table
  51.     \draw[->] let
  52.         \p1 = ($(RSSP)+(\N,0)$)
  53.     in (RSSP) -- (\p1) node[right,anchor=west] (RSS) at (\p1) {Row Slicing/Selection};
  54.  
  55.    \draw[->] let
  56.        \p1 = (RSS.south),
  57.        \p2 = ($(\p1)-(0,\N)$)
  58.    in (\p1) -- (\p2) coordinate[below] (RSST) at (\p2);
  59.  
  60.    \begin{scope}[shift=($(RSST)$),xshift=-3.5em,anchor=north west]
  61.        \matrix (m) [matrix of math nodes, row sep=1em, column sep=1em] {
  62.            1 & A_1 & B_1 & C_1 & D_1 \\
  63.            2 & A_2 & B_2 & C_2 & D_2 \\
  64.            3 & A_3 & B_3 & C_3 & D_3 \\
  65.        };
  66.    \end{scope}
  67.  
  68.     % column slicing/selection table
  69.     \draw[<-] let
  70.         \p1 = ($(m-7-3)-(0,\S)$),
  71.         \p2 = (INDEX),
  72.         \p3 = ($(\x1,\y2)+(1em,0)$)
  73.     in (\p1) |- (\p3) node[right,anchor=west] (CSS) at (\p3) {Column Slicing/Selection};
  74.    
  75.    \draw[<-] let
  76.        \p1 = (CSS.south),
  77.        \p2 = ($(\p1)-(0,\N)$)
  78.    in (\p1) -- (\p2) coordinate[below] (CSST) at (\p2);
  79.  
  80.    \begin{scope}[shift=($(CSST)$),xshift=-3.5em,anchor=north west]
  81.        \matrix (m) [matrix of math nodes, row sep=1em, column sep=1em] {
  82.            0      & B_0\\
  83.            1      & B_1\\
  84.            2      & B_2\\
  85.            3      & B_3\\
  86.            \vdots & \vdots\\
  87.            n      & B_n\\
  88.        };
  89.    \end{scope}
  90. \end{tikzpicture}
  91. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement