Reduce vertical space between bars in pgfgantt
I just submitted pgfgantt v2.0 to CTAN. Among several other new features, this version introduces the three keys x unit
, y unit title
and y unit chart
. These keys should allow you to use different line heights in the title and the remainder of the chart.
The best I could do is to adjust the y-scale to y=0.50cm
, and add bar top shift=-0.1, bar height=0.6
to get the horizontal bars the original height. This also necessitated tweaking the title setup, so am thinking that there must be a better way, but hopefully this helps:
\documentclass[a4paper,11pt]{article}
\usepackage{pgfgantt}
\begin{document}
\section{}
\begin{tikzpicture}[y=0.75cm]
\begin{ganttchart}[bar={fill=red!50},vgrid, hgrid]{5}
\gantttitle{2012--2017}{5} \\
\gantttitlelist{1,...,5}{1} \\
\ganttbar{PhD1}{1}{3.5} \\
\ganttbar{PhD2}{2.5}{5} \\
\end{ganttchart}
\end{tikzpicture}
%
\begin{tikzpicture}[y=0.50cm]
\begin{ganttchart}[bar={fill=red!50},vgrid, hgrid,
title height=.75, title top shift=0,
title label anchor={below=-1.5ex},
bar top shift=-0.1, bar height=0.6]{5}
\gantttitle{2012--2017}{5} \\
\gantttitlelist{1,...,5}{1} \\
\ganttbar{PhD1}{1}{3.5} \\
\ganttbar{PhD2}{2.5}{5} \\
\end{ganttchart}
\end{tikzpicture}
\end{document}
The x=3cm
was removed just to be able to show a before and after.
in v4.0 from 2013/06/01 you can use something like:
\begin{ganttchart}[y unit chart=2cm]{0}{10}
\ganttbar{magic}{3}{8}\\
\ganttbar{magic2}{2}{8}\\
\end{ganttchart}
see page 7 official documentation