12

I recently discovered tikz and I fell in love with it! However, I am having some annoying issues when I try to include a tikz mindmap in beamer. Problem is that I can't manage to have the mindmap scaled to the beamer slide size. Below is my code, see attached image for my output. Thanks!

\documentclass[8pt,T]{beamer}  
\usepackage{comment} 
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees, backgrounds}

\useoutertheme{tree}
\useinnertheme{rectangles}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{frametitle}{bg=black}
\setbeamercolor{block body}{fg=black}
\setbeamercolor{alertblock body}{fg=black}
\setbeamertemplate{blocks}[default]
\usecolortheme[named=orange]{structure}
\usetheme{Antibes}

\title{Bla bla}
\author{George Azzari}

\begin{document}
\section{Introduction}
\begin{frame}
\centering
\begin{figure}[h]
\makebox[\textwidth][c]{
\begin{tikzpicture}
%%%%%%%%%%%%%%% CANOPY STRUCTURE
  \path[mindmap,concept color=green!50!black, text=white]

    node[concept](struct) at (0,0){Canopy Structure}
            child[grow = -45, concept color = orange]{
            node[concept](light){Light Interception}
                    [clockwise from = 20]
                    child{node[concept](alb) {Shortwave albedo}}
                    child{node[concept](lw){Longwave Emissivity}}
                    child{node[concept](shade){Shading}}
                    }
        %----------------------------------------------------------
            child[grow = 45, concept color = green!50!yellow!70!black]{
                node[concept](func){Ecosystem Function}
                    [counterclockwise from = -20]
                    child{node[concept](massflu) {Mass Fluxes}}
                    child{node[concept](biom) {Biomass}}
                    child{node[concept](prod){Production}}
                    child{node[concept](comp) {Competition}
                        child{}}
                    }
        %----------------------------------------------------------
            child[grow = 0, concept color = blue!60!white]{
                node[concept](rough) at (0.5,0){Turbolence}
                    child[grow = 20]{node[concept](lh){Latent Heat}}
                    child[grow = -20]{node[concept](sh){Sensible Heat}}};
        %----------------------------------------------------------

%%%%%%%%%%%% ATMOSPHERE
  \path[mindmap,concept color=blue!80!white!60!green, text=white]
    node[concept](atmos) at (12,4){Atmospheric Exchanges};

%%%%%%%%%%%% ENERGY
  \path[mindmap,concept color=red!50!black, text=white]
    node[concept](energy) at (12,-4){Surface Energy};

%%%%%%%%%%%%% MAKING SECONDARY CONNECTIONS 
  \newcommand{\conngreentoorange}{to[circle connection bar switch color=from (green!50!yellow!70!black) to (orange)]}
  \newcommand{\connredtoorange}{to[circle connection bar switch color=from (red!50!black) to (orange)]}
  \newcommand{\connredtoblu}{to[circle connection bar switch color=from (red!50!black) to (blue!60!white)]}
  \newcommand{\connazuretoblu}{to[circle connection bar switch color=from (blue!80!white!60!green) to (blue!60!white)]}
  \newcommand{\connazuretogreen}{to[circle connection bar switch color=from (blue!80!white!60!green) to (green!50!yellow!70!black)]}
  \newcommand{\connazuretored}{to[circle connection bar switch color=from (blue!80!white!60!green) to (red!50!black)]}
  \newcommand{\connblutogreen}{to[circle connection bar switch color=from (blue!60!white) to (green!50!yellow!70!black)]}
  \begin{pgfonlayer}{background}
    %\draw [circle connection bar ]
      \path (func)  \conngreentoorange (light);
      \path (energy)\connredtoorange (alb);      
      \path (energy)\connredtoorange (lw);
      \path (energy)\connredtoblu (sh);
      \path (energy)\connredtoblu (lh);
      \path (atmos) \connazuretoblu (lh);
      \path (atmos) \connazuretoblu (sh);
      \path (atmos) \connazuretored (energy);
      \path (atmos) \connazuretogreen (massflu);
      \path (lh) \connblutogreen (massflu);
  \end{pgfonlayer}
\end{tikzpicture}}
\end{figure}
\end{frame}
\end{document}

enter image description here

14

Along this site it is possible to find a lot of questions and answers related to scaling tikzpictures. Here I add some references:

In particular:

and

Starting from you example, it was sufficient to properly declare the distances of the various mindmap's levels by means of:

\tikzset{level 1 concept/.append style={font=\sf, sibling angle=90,level distance = 27mm}}
\tikzset{level 2 concept/.append style={font=\sf, sibling angle=45,level distance = 17mm}}
\tikzset{every node/.append style={scale=0.6}}

and to change the position of the concepts Atmospheric Exchanges and Surface Energy: you gave them by hand, but they actually were placed too much far.

Notice also that I removed yours

\begin{figure}[h]
\makebox[\textwidth][c]{

not really needed.

The complete code:

\documentclass[8pt,T]{beamer}  
\usepackage{comment} 
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees, backgrounds}

\tikzset{level 1 concept/.append style={font=\sf, sibling angle=90,level distance = 27mm}}
\tikzset{level 2 concept/.append style={font=\sf, sibling angle=45,level distance = 17mm}}
\tikzset{every node/.append style={scale=0.6}}    

\useoutertheme{tree}
\useinnertheme{rectangles}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{frametitle}{bg=black}
\setbeamercolor{block body}{fg=black}
\setbeamercolor{alertblock body}{fg=black}
\setbeamertemplate{blocks}[default]
\usecolortheme[named=orange]{structure}
\usetheme{Antibes}

\title{Bla bla}
\author{George Azzari}

\begin{document}
\section{Introduction}
\begin{frame}
\begin{tikzpicture}
%%%%%%%%%%%%%%% CANOPY STRUCTURE
  \path[mindmap,concept color=green!50!black, text=white]

    node[concept](struct) at (0,0){Canopy Structure}
            child[grow = -45, concept color = orange]{
            node[concept](light){Light Interception}
                    [clockwise from = 20]
                    child{node[concept](alb) {Shortwave albedo}}
                    child{node[concept](lw){Longwave Emissivity}}
                    child{node[concept](shade){Shading}}
                    }
        %----------------------------------------------------------
            child[grow = 45, concept color = green!50!yellow!70!black]{
                node[concept](func){Ecosystem Function}
                    [counterclockwise from = -20]
                    child{node[concept](massflu) {Mass Fluxes}}
                    child{node[concept](biom) {Biomass}}
                    child{node[concept](prod){Production}}
                    child{node[concept](comp) {Competition}}
                    }
        %----------------------------------------------------------
            child[grow = 0, concept color = blue!60!white]{
                node[concept](rough) at (0.5,0){Turbolence}
                    child[grow = 20]{node[concept](lh){Latent Heat}}
                    child[grow = -20]{node[concept](sh){Sensible Heat}}};
        %----------------------------------------------------------

%%%%%%%%%%%% ATMOSPHERE
  \path[mindmap,concept color=blue!80!white!60!green, text=white]
    node[concept](atmos) at (8,2){Atmospheric Exchanges};

%%%%%%%%%%%% ENERGY
  \path[mindmap,concept color=red!50!black, text=white]
    node[concept](energy) at (8,-2){Surface Energy};

%%%%%%%%%%%%% MAKING SECONDARY CONNECTIONS 
  \newcommand{\conngreentoorange}{to[circle connection bar switch color=from (green!50!yellow!70!black) to (orange)]}
  \newcommand{\connredtoorange}{to[circle connection bar switch color=from (red!50!black) to (orange)]}
  \newcommand{\connredtoblu}{to[circle connection bar switch color=from (red!50!black) to (blue!60!white)]}
  \newcommand{\connazuretoblu}{to[circle connection bar switch color=from (blue!80!white!60!green) to (blue!60!white)]}
  \newcommand{\connazuretogreen}{to[circle connection bar switch color=from (blue!80!white!60!green) to (green!50!yellow!70!black)]}
  \newcommand{\connazuretored}{to[circle connection bar switch color=from (blue!80!white!60!green) to (red!50!black)]}
  \newcommand{\connblutogreen}{to[circle connection bar switch color=from (blue!60!white) to (green!50!yellow!70!black)]}
  \begin{pgfonlayer}{background}
    %\draw [circle connection bar ]
      \path (func)  \conngreentoorange (light);
      \path (energy)\connredtoorange (alb);      
      \path (energy)\connredtoorange (lw);
      \path (energy)\connredtoblu (sh);
      \path (energy)\connredtoblu (lh);
      \path (atmos) \connazuretoblu (lh);
      \path (atmos) \connazuretoblu (sh);
      \path (atmos) \connazuretored (energy);
      \path (atmos) \connazuretogreen (massflu);
      \path (lh) \connblutogreen (massflu);
  \end{pgfonlayer}
\end{tikzpicture}
\end{frame}
\end{document}

The result:

enter image description here

  • Cool, grazie Claudio! It looks great now. – Cronopio Oct 18 '12 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.