[Tex/LaTex] How to scale a Gantt figure

floatspgfganttscaling

Sketch:

I was trying to scale a Gantt chart in order to fit in to a Beamer presentation.

Suppose I have some gantt chart bigger than the presentation rectangle:

 \begin{figure}
   \begin{gantt}{20}{20}
     \begin{ganttitle}
       \numtitle{2012}{1}{2016}{4}
     \end{ganttitle}

     %% lots of activities
     \ganttbar{1}{0}{3}
     ...
     ...
     \ganttbar{1}{0}{19}
     %% lots of activities
   \end{gantt}
 \end{figure}

Question:
How can I scale this figure to fix in a beamer frame?

Example:
If I was using some PNG image, surely I will make this:

\begin{figure}
  \includegraphic[scale=0.5]{mypngpic.png}
\end{figure}

But in gantt environment there is no (at least I don't know yet) a way to scale.

Best Answer

Since the gantt is based on TikZ, forcing the scale externally also works. I didn't check the code carefully but maybe there is a possibility to supply the options directly to the gantt environment. It has it's own key system but it didn't recognize the scale options.

\documentclass{article}
\usepackage{gantt}
\begin{document}
\tikzset{every picture/.style={yscale=0.3,transform shape}}
   \begin{gantt}{5}{12}
     \begin{ganttitle}
       \numtitle{2012}{1}{2014}{4}
     \end{ganttitle}
     %% lots of activities
     \ganttbar{1}{0}{3}
     \ganttbar{1}{0}{10}
     %% lots of activities
   \end{gantt}

\tikzset{every picture/.style={yscale=1,transform shape}}
   \begin{gantt}{5}{12}
     \begin{ganttitle}
       \numtitle{2012}{1}{2014}{4}
     \end{ganttitle}
     %% lots of activities
     \ganttbar{1}{0}{3}
     \ganttbar{1}{0}{10}
     %% lots of activities
   \end{gantt}

\end{document}

enter image description here Note also that there is another TikZ based package pgfgantt.