5

I want to to reduce the size of the node to which they perceived better in my presentation; the problem is that the nodes are overlap.

I have the code from Drawing a tree where many nodes have the same child in TikZ :

  \begin{tikzpicture} [sibling distance=1.5cm]
      \node [size=0.3cm](topnode) at (0,5) { {\{\{1\}\{2\}\}\{3\}\{4\}}\} } 
      child { node[size=0.3cm] {{\{\{1,2\}\{3\}\{4\}}\}} }
      child { node[size=0.3cm] {{\{\{1,3\}\{2\}\{4\}}\}} }
      child { node[size=0.3cm] {{\{\{1,4\}\{2\}\{3\}}\}} }
      child { node[size=0.3cm] {{\{\{2,3\}\{1\}\{4\}}\}} }
      child { node[size=0.3cm] {{\{\{2,4\}\{1\}\{3\}}\}} }
      child { node[size=0.3cm] {{\{\{3,4\}\{1\}\{2\}}\}} }
      ;


      \node[minimum width=3cm](bottomnode) {\{\{1,2,3,4\}\}} [grow'=up]
      child { node[size=0.3cm] {{\{\{1,2,3\}\{4\}}\}} }
      child { node[size=0.3cm] {{\{\{1,2,4\}\{3\}}\}} }
      child { node[size=0.3cm] {{\{\{1,2\}\{3,4\}}\}} }
      child { node[size=0.3cm] {{\{\{1,3,4\}\{2\}}\}} }
      child { node[size=0.3cm] {{\{\{1,3\}\{2,4\}}\}} }
      child { node[size=0.3cm] {{\{\{1,4\}\{2,3\}}\}} }
      child { node[size=0.3cm] {{\{\{2,3,4\}\{1\}}\}} }
      ;
      \foreach \x in {1,2,3}{
      \draw  [blue](topnode-1) -- (bottomnode-\x);
      }

      \foreach \x in {1,4,5}{
      \draw (topnode-2) -- (bottomnode-\x);
      }

      \foreach \x in {2,4,6}{
      \draw  [red] (topnode-3) -- (bottomnode-\x);
      }
      \foreach \x in {2,4,6}{
      \draw  [red] (topnode-3) -- (bottomnode-\x);
      }

      \foreach \x in {1,6,7}{
      \draw  [blue](topnode-4) -- (bottomnode-\x);
      }

      \foreach \x in {2,7,5}{
      \draw  [red](topnode-5) -- (bottomnode-\x);
      }

      \foreach \x in {3,4,7}{
      \draw (topnode-6) -- (bottomnode-\x);
      }

      \end{tikzpicture}

enter image description here

1 Answer 1

4

The simplest solution is to reduce the font size of nodes. You can do it by introducing:

\tikzset{every node/.append style={font=\tiny}}

Here is the MWE:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{trees}
\usetheme{Frankfurt}

\begin{document}
\begin{frame}{TITLE}


\begin{tikzpicture} [sibling distance=1.5cm]
\tikzset{every node/.append style={font=\tiny}}
      \node [minimum size=0.3cm](topnode) at (0,5) { {\{\{1\}\{2\}\}\{3\}\{4\}}\} } 
      child { node[minimum size=0.3cm] {{\{\{1,2\}\{3\}\{4\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,3\}\{2\}\{4\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,4\}\{2\}\{3\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{2,3\}\{1\}\{4\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{2,4\}\{1\}\{3\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{3,4\}\{1\}\{2\}}\}} }
      ;


      \node[minimum width=3cm](bottomnode) {\{\{1,2,3,4\}\}} [grow'=up]
      child { node[minimum size=0.3cm] {{\{\{1,2,3\}\{4\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,2,4\}\{3\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,2\}\{3,4\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,3,4\}\{2\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,3\}\{2,4\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{1,4\}\{2,3\}}\}} }
      child { node[minimum size=0.3cm] {{\{\{2,3,4\}\{1\}}\}} }
      ;
      \foreach \x in {1,2,3}{
      \draw  [blue](topnode-1) -- (bottomnode-\x);
      }

      \foreach \x in {1,4,5}{
      \draw (topnode-2) -- (bottomnode-\x);
      }

      \foreach \x in {2,4,6}{
      \draw  [red] (topnode-3) -- (bottomnode-\x);
      }
      \foreach \x in {2,4,6}{
      \draw  [red] (topnode-3) -- (bottomnode-\x);
      }

      \foreach \x in {1,6,7}{
      \draw  [blue](topnode-4) -- (bottomnode-\x);
      }

      \foreach \x in {2,7,5}{
      \draw  [red](topnode-5) -- (bottomnode-\x);
      }

     \foreach \x in {3,4,7}{
     \draw (topnode-6) -- (bottomnode-\x);
      }

      \end{tikzpicture}

\end{frame}

\end{document}

which leads to:

enter image description here

Notice that in your example I had compilation problems due to the option size= which I turned into minimum size=.

1
  • I find it very hard to see where one node ends and the next one starts. I added rotate=10 to the nodes style to make it better distinguishable. Jun 11, 2012 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .