Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created August 23, 2024 03:21
Show Gist options
  • Save abikoushi/79d567ba7d230631d7d029ec5ea0b3d7 to your computer and use it in GitHub Desktop.
Save abikoushi/79d567ba7d230631d7d029ec5ea0b3d7 to your computer and use it in GitHub Desktop.
\documentclass[tikz,border=14pt, dvipsnames]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,decorations.pathreplacing, backgrounds, positioning}
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}[
%Styles
Matrix/.style={
matrix of nodes,
text height=2.5ex,
text depth=0.75ex,
text width=8.0ex,
align=center,
column sep=0pt, row sep=0pt,
nodes={draw=black!50},
nodes in empty cells,
}
]
%data frame
\matrix[Matrix] at(0,0) (tM){ % Matrix contents
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
& & \\
};
\foreach \y in {1,2,3} {
\foreach \x in {1,2,3,4} {
\pgfmathparse{0.9*rnd+0.3}
\definecolor{MyColor}{cmyk}{0,0,\pgfmathresult,0}
\node[fill=MyColor,
text height=2.2ex, text depth=0.73ex,
text width=7.7ex] at (tM-\x-\y){};
}
}
\foreach \y in {1,2,3} {
\foreach \x in {5,6,7} {
\pgfmathparse{0.9*rnd+0.3}
\definecolor{MyColor}{cmyk}{\pgfmathresult,0,0,0}
\node[fill=MyColor,
text height=2.2ex, text depth=0.73ex,
text width=7.7ex] at (tM-\x-\y){};
}
}
\foreach \y in {1,2,3} {
\foreach \x in {8,9,10} {
\pgfmathparse{0.9*rnd+0.3}
\definecolor{MyColor}{cmyk}{0,\pgfmathresult,0,0}
\node[fill=MyColor,
text height=2.2ex, text depth=0.73ex,
text width=7.7ex] at (tM-\x-\y){};
}
}
\matrix[Matrix, left = of tM, xshift = +20pt](X){ % Matrix contents
\checkmark \\
\\
\\
\\
\checkmark \\
\\
\\
\\
\checkmark \\
\\
};
\node[yshift = 20pt, draw, circle](labV) at (tM-1-2.north){$V$};
\node[yshift = 15pt, draw, circle, fill=gray, text=white](labX) at (X.north){$x_n$};
\path[decorate, decoration ={brace, mirror}, draw]
(X-1-1.north west) -- (X-4-1.south west) node[midway, rotate=90, yshift = 10pt]{sample};
\path[decorate, decoration ={brace, mirror}, draw]
(X-5-1.north west) -- (X-7-1.south west) node[midway, rotate=90, yshift = 10pt]{modality};
\path[decorate, decoration ={brace, mirror}, draw]
(X-8-1.north west) -- (X-10-1.south west) node[midway, rotate=90, yshift = 10pt]{feature};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment