1

Is it possible fade/shade the bottom of this figure into white?

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes}
\usetikzlibrary{tikzmark}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[remember picture] \node [anchor=west] (Y0) at (0, 0) {$Y^0 = {$ \quad \subnode[anchor=base]{yc-0-1}{$y_1$}, \qquad \quad \quad \quad \subnode{yc-0-2}{$y_2$}, \qquad \quad \quad \quad \subnode{yc-0-3}{$y_3$}, \qquad \quad \quad \quad \subnode{yc-0-4}{$y_4$} \quad \subnode{brktc0}{$ }$} };

\node [anchor=west] (Y1) at (0, -2.5) {$Y^1 = \{$
    \subnode{yc-1-1}{$\overbrace{\{y_1, y_2\}}^{y^1_1}$}, \
    \subnode{yc-1-2}{$\overbrace{\{y_1, y_3\}}^{y^1_2}$}, \
    \subnode{yc-1-3}{$\overbrace{\{y_1, y_4\}}^{y^1_3}$}, \
    \subnode{yc-1-4}{$\overbrace{\{y_2, y_3\}}^{y^1_4}$}, \
    \subnode{yc-1-5}{$\overbrace{\{y_2, y_4\}}^{y^1_5}$}, \
    \subnode{yc-1-6}{$\overbrace{\{y_3, y_4\}}^{y^1_6}$}
    \subnode{brktc1}{$ \}$}
};


\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}] 
\draw[postaction={decorate}, gray!20] (yc-0-4.south) to (yc-1-6.north);
\draw[postaction={decorate}, gray!20] (yc-0-4.south) to (yc-1-5.north);
\draw[postaction={decorate}, gray!20] (yc-0-4.south) to (yc-1-3.north);
\draw[postaction={decorate}, gray!40] (yc-0-3.south) to (yc-1-6.north);
\draw[postaction={decorate}, gray!40] (yc-0-3.south) to (yc-1-4.north);
\draw[postaction={decorate}, gray!40] (yc-0-3.south) to (yc-1-2.north);
\draw[postaction={decorate}, gray!70] (yc-0-2.south) to (yc-1-5.north);
\draw[postaction={decorate}, gray!70] (yc-0-2.south) to (yc-1-4.north);
\draw[postaction={decorate}, gray!70] (yc-0-2.south) to (yc-1-1.north);
\draw[postaction={decorate}] (yc-0-1.south) to (yc-1-2.north);
\draw[postaction={decorate}] (yc-0-1.south) to (yc-1-3.north);
\draw[postaction={decorate}] (yc-0-1.south) to (yc-1-1.north);

\end{scope}

\node [anchor=west] (Y2) at (0, -5) {$Y^2 = \{$
    \subnode{yc-2-1}{$\overbrace{\{y^1_1, y^1_2\}}^{y^2_1}$}, \
    \subnode{yc-2-2}{$\overbrace{\{y^1_1, y^1_3\}}^{y^2_2}$}, \
    \subnode{yc-2-3}{$\overbrace{\{y^1_1, y^1_4\}}^{y^2_3}$}, \
    \subnode{yc-2-4}{$\overbrace{\{y^1_1, y^1_5\}}^{y^2_4}$}, \
    \subnode{yc-2-5}{$\overbrace{\{y^1_1, y^1_6\}}^{y^2_5}$}, \
    \dots
    \subnode{yc-2-6}{$\overbrace{\{y^1_5, y^1_6\}}^{y^2_{15}}$}\
    \subnode{brktc2}{$ \}$}
};

\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}]
    \draw[postaction={decorate}, gray!20] (yc-1-6.south) to (yc-2-6.north);
    \draw[postaction={decorate}, gray!20] (yc-1-6.south) to (yc-2-5.north);
    \draw[postaction={decorate}, gray!20] (yc-1-5.south) to (yc-2-6.north);
    \draw[postaction={decorate}, gray!20] (yc-1-5.south) to (yc-2-4.north);
    \draw[postaction={decorate}, gray!30] (yc-1-4.south) to (yc-2-3.north);
    \draw[postaction={decorate}, gray!40] (yc-1-3.south) to (yc-2-2.north);
    \draw[postaction={decorate}, gray!70] (yc-1-2.south) to (yc-2-1.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-4.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-5.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-3.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-2.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-1.north);
\end{scope}

\node [anchor=west] (Y3) at (0, -7.5) {$Y^3 = \{$
    \subnode{yc-3-1}{$\overbrace{\{y^2_1, y^2_2\}}^{y^3_1}$}, \
    \subnode{yc-3-2}{$\overbrace{\{y^2_1, y^2_3\}}^{y^3_2}$}, \
    \subnode{yc-3-3}{$\overbrace{\{y^2_1, y^2_4\}}^{y^3_3}$}, \
    \subnode{yc-3-4}{$\overbrace{\{y^2_1, y^2_5\}}^{y^3_4}$}, \
    \subnode{yc-3-5}{$\overbrace{\{y^2_1, y^2_6\}}^{y^3_5}$}, \
    \dots
    \subnode{yc-3-6}{$\overbrace{\{y^2_{14}, y^2_{15}\}}^{y^3_{105}}$}\
    \subnode{brktc3}{$ \}$}
};

\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}]
    \draw[postaction={decorate}, gray!20] (yc-2-6.south) to (yc-3-6.north);
    \draw[postaction={decorate}, gray!20] (yc-2-6.south) to (yc-3-5.north);
    \draw[postaction={decorate}, gray!20] (yc-2-5.south) to (yc-3-6.north);
    \draw[postaction={decorate}, gray!20] (yc-2-5.south) to (yc-3-4.north);
    \draw[postaction={decorate}, gray!30] (yc-2-4.south) to (yc-3-3.north);
    \draw[postaction={decorate}, gray!40] (yc-2-3.south) to (yc-3-2.north);
    \draw[postaction={decorate}, gray!70] (yc-2-2.south) to (yc-3-1.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-4.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-5.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-3.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-2.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-1.north);
\end{scope}

\node [anchor=west] (Y4) at (0, -10) {$Y^4 = \{$
    \subnode{yc-4-1}{$\overbrace{\{y^3_1, y^3_2\}}^{y^4_1}$}, \
    \subnode{yc-4-2}{$\overbrace{\{y^3_1, y^3_3\}}^{y^4_2}$}, \
    \subnode{yc-4-3}{$\overbrace{\{y^3_1, y^3_4\}}^{y^4_3}$}, \
    \subnode{yc-4-4}{$\overbrace{\{y^3_1, y^3_5\}}^{y^4_4}$}, \
    \subnode{yc-4-5}{$\overbrace{\{y^3_1, y^3_6\}}^{y^4_5}$}, \
    \dots
    \subnode{yc-4-6}{$\overbrace{\{y^3_{104}, y^3_{105}\}}^{y^4_{5460}}$}\
    \subnode{brktc4}{$ \}$}
};

\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}]
    \draw[postaction={decorate}, gray!20] (yc-3-6.south) to (yc-4-6.north);
    \draw[postaction={decorate}, gray!20] (yc-3-6.south) to (yc-4-5.north);
    \draw[postaction={decorate}, gray!20] (yc-3-5.south) to (yc-4-6.north);
    \draw[postaction={decorate}, gray!20] (yc-3-5.south) to (yc-4-4.north);
    \draw[postaction={decorate}, gray!30] (yc-3-4.south) to (yc-4-3.north);
    \draw[postaction={decorate}, gray!40] (yc-3-3.south) to (yc-4-2.north);
    \draw[postaction={decorate}, gray!70] (yc-3-2.south) to (yc-4-1.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-4.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-5.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-3.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-2.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-1.north);
\end{scope}


\end{tikzpicture}

\end{document}

I would like to get something like this

enter image description here

Cesare
  • 157

1 Answers1

2

Using the approach from here Tikz fade with transparency so background is visible in beamer? you can produce

enter image description here

by applying a gradient

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes}
\usetikzlibrary{tikzmark}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{fadings}

\tikzfading[name=myfade, top color=transparent!100, bottom color=transparent!0]

\begin{document}

\begin{tikzpicture}[remember picture] \node [anchor=west] (Y0) at (0, 0) {$Y^0 = {$ \quad \subnode[anchor=base]{yc-0-1}{$y_1$}, \qquad \quad \quad \quad \subnode{yc-0-2}{$y_2$}, \qquad \quad \quad \quad \subnode{yc-0-3}{$y_3$}, \qquad \quad \quad \quad \subnode{yc-0-4}{$y_4$} \quad \subnode{brktc0}{$ }$} };

\node [anchor=west] (Y1) at (0, -2.5) {$Y^1 = \{$
    \subnode{yc-1-1}{$\overbrace{\{y_1, y_2\}}^{y^1_1}$}, \
    \subnode{yc-1-2}{$\overbrace{\{y_1, y_3\}}^{y^1_2}$}, \
    \subnode{yc-1-3}{$\overbrace{\{y_1, y_4\}}^{y^1_3}$}, \
    \subnode{yc-1-4}{$\overbrace{\{y_2, y_3\}}^{y^1_4}$}, \
    \subnode{yc-1-5}{$\overbrace{\{y_2, y_4\}}^{y^1_5}$}, \
    \subnode{yc-1-6}{$\overbrace{\{y_3, y_4\}}^{y^1_6}$}
    \subnode{brktc1}{$ \}$}
};


\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}] 
\draw[postaction={decorate}, gray!20] (yc-0-4.south) to (yc-1-6.north);
\draw[postaction={decorate}, gray!20] (yc-0-4.south) to (yc-1-5.north);
\draw[postaction={decorate}, gray!20] (yc-0-4.south) to (yc-1-3.north);
\draw[postaction={decorate}, gray!40] (yc-0-3.south) to (yc-1-6.north);
\draw[postaction={decorate}, gray!40] (yc-0-3.south) to (yc-1-4.north);
\draw[postaction={decorate}, gray!40] (yc-0-3.south) to (yc-1-2.north);
\draw[postaction={decorate}, gray!70] (yc-0-2.south) to (yc-1-5.north);
\draw[postaction={decorate}, gray!70] (yc-0-2.south) to (yc-1-4.north);
\draw[postaction={decorate}, gray!70] (yc-0-2.south) to (yc-1-1.north);
\draw[postaction={decorate}] (yc-0-1.south) to (yc-1-2.north);
\draw[postaction={decorate}] (yc-0-1.south) to (yc-1-3.north);
\draw[postaction={decorate}] (yc-0-1.south) to (yc-1-1.north);

\end{scope}

\node [anchor=west] (Y2) at (0, -5) {$Y^2 = \{$
    \subnode{yc-2-1}{$\overbrace{\{y^1_1, y^1_2\}}^{y^2_1}$}, \
    \subnode{yc-2-2}{$\overbrace{\{y^1_1, y^1_3\}}^{y^2_2}$}, \
    \subnode{yc-2-3}{$\overbrace{\{y^1_1, y^1_4\}}^{y^2_3}$}, \
    \subnode{yc-2-4}{$\overbrace{\{y^1_1, y^1_5\}}^{y^2_4}$}, \
    \subnode{yc-2-5}{$\overbrace{\{y^1_1, y^1_6\}}^{y^2_5}$}, \
    \dots
    \subnode{yc-2-6}{$\overbrace{\{y^1_5, y^1_6\}}^{y^2_{15}}$}\
    \subnode{brktc2}{$ \}$}
};

\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}]
    \draw[postaction={decorate}, gray!20] (yc-1-6.south) to (yc-2-6.north);
    \draw[postaction={decorate}, gray!20] (yc-1-6.south) to (yc-2-5.north);
    \draw[postaction={decorate}, gray!20] (yc-1-5.south) to (yc-2-6.north);
    \draw[postaction={decorate}, gray!20] (yc-1-5.south) to (yc-2-4.north);
    \draw[postaction={decorate}, gray!30] (yc-1-4.south) to (yc-2-3.north);
    \draw[postaction={decorate}, gray!40] (yc-1-3.south) to (yc-2-2.north);
    \draw[postaction={decorate}, gray!70] (yc-1-2.south) to (yc-2-1.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-4.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-5.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-3.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-2.north);
    \draw[postaction={decorate}] (yc-1-1.south) to (yc-2-1.north);
\end{scope}

\node [anchor=west] (Y3) at (0, -7.5) {$Y^3 = \{$
    \subnode{yc-3-1}{$\overbrace{\{y^2_1, y^2_2\}}^{y^3_1}$}, \
    \subnode{yc-3-2}{$\overbrace{\{y^2_1, y^2_3\}}^{y^3_2}$}, \
    \subnode{yc-3-3}{$\overbrace{\{y^2_1, y^2_4\}}^{y^3_3}$}, \
    \subnode{yc-3-4}{$\overbrace{\{y^2_1, y^2_5\}}^{y^3_4}$}, \
    \subnode{yc-3-5}{$\overbrace{\{y^2_1, y^2_6\}}^{y^3_5}$}, \
    \dots
    \subnode{yc-3-6}{$\overbrace{\{y^2_{14}, y^2_{15}\}}^{y^3_{105}}$}\
    \subnode{brktc3}{$ \}$}
};

\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}]
    \draw[postaction={decorate}, gray!20] (yc-2-6.south) to (yc-3-6.north);
    \draw[postaction={decorate}, gray!20] (yc-2-6.south) to (yc-3-5.north);
    \draw[postaction={decorate}, gray!20] (yc-2-5.south) to (yc-3-6.north);
    \draw[postaction={decorate}, gray!20] (yc-2-5.south) to (yc-3-4.north);
    \draw[postaction={decorate}, gray!30] (yc-2-4.south) to (yc-3-3.north);
    \draw[postaction={decorate}, gray!40] (yc-2-3.south) to (yc-3-2.north);
    \draw[postaction={decorate}, gray!70] (yc-2-2.south) to (yc-3-1.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-4.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-5.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-3.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-2.north);
    \draw[postaction={decorate}] (yc-2-1.south) to (yc-3-1.north);
\end{scope}

\node [anchor=west] (Y4) at (0, -10) {$Y^4 = \{$
    \subnode{yc-4-1}{$\overbrace{\{y^3_1, y^3_2\}}^{y^4_1}$}, \
    \subnode{yc-4-2}{$\overbrace{\{y^3_1, y^3_3\}}^{y^4_2}$}, \
    \subnode{yc-4-3}{$\overbrace{\{y^3_1, y^3_4\}}^{y^4_3}$}, \
    \subnode{yc-4-4}{$\overbrace{\{y^3_1, y^3_5\}}^{y^4_4}$}, \
    \subnode{yc-4-5}{$\overbrace{\{y^3_1, y^3_6\}}^{y^4_5}$}, \
    \dots
    \subnode{yc-4-6}{$\overbrace{\{y^3_{104}, y^3_{105}\}}^{y^4_{5460}}$}\
    \subnode{brktc4}{$ \}$}
};

\begin{scope}[decoration={markings, mark=at position 0.85 with {\arrow{>}}}]
    \draw[postaction={decorate}, gray!20] (yc-3-6.south) to (yc-4-6.north);
    \draw[postaction={decorate}, gray!20] (yc-3-6.south) to (yc-4-5.north);
    \draw[postaction={decorate}, gray!20] (yc-3-5.south) to (yc-4-6.north);
    \draw[postaction={decorate}, gray!20] (yc-3-5.south) to (yc-4-4.north);
    \draw[postaction={decorate}, gray!30] (yc-3-4.south) to (yc-4-3.north);
    \draw[postaction={decorate}, gray!40] (yc-3-3.south) to (yc-4-2.north);
    \draw[postaction={decorate}, gray!70] (yc-3-2.south) to (yc-4-1.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-4.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-5.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-3.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-2.north);
    \draw[postaction={decorate}] (yc-3-1.south) to (yc-4-1.north);
\end{scope}

\fill[draw,white,path fading=myfade] (0,-3) rectangle (\linewidth,-11);
\end{tikzpicture}

\end{document}

TobiBS
  • 5,240
  • Thanks! Is it possible to have the shading starting from a specific height, so that above a certain point there is no fading? – Cesare Jun 20 '20 at 13:32
  • Oh, you have done that already, right? I had missed it, sorry. – Cesare Jun 20 '20 at 13:40
  • @Cesare yes, you can change the area that shall be shaded by adjusting (0,-3) rectangle (\linewidth,-11) and if you want those can be realtive nodes or anchors of nodes. – TobiBS Jun 20 '20 at 13:45
  • Yes. I had seen that only later. It's perfect, thanks. – Cesare Jun 20 '20 at 13:49