Created
December 24, 2025 03:45
-
-
Save abikoushi/efcfc6becf14e174a1de8d4464db9b51 to your computer and use it in GitHub Desktop.
A TikZ picture of HairEyeColor data as ALTO format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %ref: | |
| %https://tex.stackexchange.com/questions/516073/how-to-draw-3d-matrix-using-tikz | |
| %https://tikz.net/tikz-table/ | |
| %https://tikz.net/conv2d/ | |
| % | |
| \documentclass[tikz,border=10pt]{standalone} | |
| \usepackage[dvipsnames]{xcolor} | |
| \usetikzlibrary{matrix,positioning} | |
| \begin{document} | |
| \tikzset{ | |
| table/.style={ | |
| matrix of nodes, | |
| row sep=-\pgflinewidth, | |
| column sep=-\pgflinewidth, | |
| nodes={ | |
| rectangle, | |
| draw=black, | |
| fill=white, | |
| align=center | |
| }, | |
| minimum height=1.5em, | |
| text depth=0.5ex, | |
| text height=2.5ex, | |
| nodes in empty cells, | |
| %% | |
| % every row/.style={ | |
| % nodes={fill=white} | |
| %}, | |
| column 1/.style={ | |
| nodes={text width=4em, font=\bfseries} | |
| }, | |
| row 1/.style={ | |
| nodes={ | |
| fill=gray, | |
| text=white, | |
| font=\bfseries | |
| } | |
| } | |
| } | |
| } | |
| \begin{tikzpicture} | |
| \matrix(alto) [table, text width=6em] | |
| { | |
| index & Hair & Eye & Sex & Freq\\ | |
| 0 & Black & Brown & Male & 32\\ | |
| 1 & Brown & Brown & Male & 53\\ | |
| 2 & Red & Brown & Male & 10\\ | |
| \vdots &\vdots & \vdots & \vdots &\vdots\\ | |
| 20 & Black & Blue & Female & 9\\ | |
| \vdots &\vdots & \vdots & \vdots &\vdots\\ | |
| 30 & Red & Green & Female & 7\\ | |
| 31 & Blond & Green & Female & 8\\ | |
| }; | |
| \matrix (female)[right = of alto, xshift=7em] [table, text width=5em] | |
| { | |
| & Brown & Blue & Hazel & Green\\ | |
| Black & 36 & 9 & 5 & 2\\ | |
| Brown & 66 & 34 & 29 & 14\\ | |
| Red & 16 & 7 & 7 & 7\\ | |
| Blond & 4 & 64 & 5 & 8\\ | |
| }; | |
| \matrix (male)[below= of female, xshift = -3em, yshift=7 em] [table, text width=5em] | |
| { | |
| & Brown & Blue & Hazel & Green\\ | |
| Black & 32 & 11 & 10 & 3\\ | |
| Brown & 53 & 50 & 25 & 15\\ | |
| Red & 10 & 10 & 7 & 7\\ | |
| Blond & 3 & 30 & 5 & 8\\ | |
| }; | |
| \draw[thick,-stealth] ([xshift=1ex]male.south east) -- ([xshift=1ex]female.south east) node[midway, below,rotate=45, xshift=2.5ex] {sex}; | |
| \draw[thick,-stealth] ([yshift=-1ex]male.south west) -- ([yshift=-1ex]male.south east) node[midway,below] {eye}; | |
| \draw[thick,-stealth] ([xshift=-1ex]male.north west) -- ([xshift=-1ex]male.south west) node[midway,above,rotate=90] {hair}; | |
| %\draw[thick,-stealth] ([xshift=-1ex]alto.north west) -- ([xshift=-1ex]alto.south west) node[midway, above,rotate=90] {ALTO-index}; | |
| %\draw[dashed, thick, NavyBlue, <->] (male-2-2) -- (alto-2-5); | |
| %\draw[dashed, thick, NavyBlue, <->] (male-3-2) -- (alto-3-5); | |
| \draw[dashed, very thick, lightgray, <->] (female-2-3) -- (alto-6-5); | |
| \end{tikzpicture} | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment