在 Beamer 框架内缩放 tikz 思维导图

在 Beamer 框架内缩放 tikz 思维导图

我最近发现了 tikz,并且爱上了它!但是,当我尝试将 tikz 思维导图包含在 beamer 中时,我遇到了一些烦人的问题。问题是我无法将思维导图缩放到 beamer 幻灯片大小。下面是我的代码,请参阅所附图片以了解我的输出。谢谢!

\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}

在此处输入图片描述

答案1

在这个网站上,你可以找到很多与扩展相关的问题和答案tikzpicture。我在这里添加了一些参考资料:

尤其:

从你的例子开始,通过以下方式正确声明各种思维导图级别的距离就足够了:

\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}}

并改变概念的位置Atmospheric ExchangesSurface Energy你手工给出了它们,但实际上它们被放置得太远了。

另请注意,我删除了你的

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

没有必要。

完整代码:

\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}

结果:

在此处输入图片描述

相关内容