I would like to create a figure in Latex similar to this (but then also with percentages in the blocks):
And I managed to get this far (MWE):
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
\begin{document}
\tikzset{
train/.style={
text=black,
draw,
minimum height=1cm,
minimum width=7cm,
left color=orange, right color=orange!30!white,shading angle=90},
val/.style={
draw,
text=black,
minimum height=1cm,
minimum width=2cm,
left color=orange!30!white, right color=green!30!white,shading angle=90},
test/.style={
draw,
text=black,
fill=cyan,
minimum height=1cm,
minimum width=1cm}}
\begin{tikzpicture}[thin,black]
\path
(0,0) node[train] (N) {70\%}
++(0:4.5) node[val] (C) {20\%}
+(0:2) node[test] (O) {10\%};
\end{tikzpicture}
\end{document}
Clearly, the arrows with train, validation, and test descriptions are still missing and I haven't been able to find out how to create this.
How would I go about this?
Thanks!
Normally I would recommend the decorations.pathreplacing
library to add large curly braces to tikz pictures, but in this particular siltation, it might be easier to draw a few paths with rounded corners:
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}
\usepackage{xcolor}
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
\begin{document}
\tikzset{
train/.style={
text=black,
draw,
minimum height=1cm,
minimum width=7cm,
left color=orange, right color=orange!30!white,shading angle=90},
val/.style={
draw,
text=black,
minimum height=1cm,
minimum width=2cm,
left color=orange!30!white, right color=green!30!white,shading angle=90},
test/.style={
draw,
text=black,
fill=cyan,
minimum height=1cm,
minimum width=1cm}}
\begin{tikzpicture}[thin,black]
\path
(0,0) node[train] (N) {70\%}
++(0:4.5) node[val] (C) {20\%}
+(0:2) node[test] (O) {10\%};
\draw[->,rounded corners=1mm] (-3.5,0.6) |- (0,1) -- ++(0,0.5);
\draw[->,rounded corners=1mm] (3.5,0.6) |- (0,1) -- ++(0,0.5);
\draw[->,rounded corners=1mm] (3.5,0.6) |- (4.5,1) -- ++(0,0.5);
\draw[->,rounded corners=1mm] (5.5,0.6) |- (4.5,1) -- ++(0,0.5);
\draw[->,rounded corners=1mm] (6,0.6) |- (6.5,1) -- ++(0,0.5);
\draw[->,rounded corners=1mm] (7,0.6) |- (6.5,1) -- ++(0,0.5);
\node at (0,1.7) {Train};
\node at (4.5,1.7) {Validation};
\node at (6.5,1.7) {Test};
\end{tikzpicture}
\end{document}