[Tex/LaTex] pgfgantt bar alignment off

pgfganttsharelatex

enter image description here

For some reason it looks like that, here is the code:

    \begin{landscape}
    \begin{ganttchart}{28}{28}
    \gantttitle{2012}{12}
    \gantttitle{2013}{16} \\
    \gantttitle{October}{4}
    \gantttitle{November}{4}
    \gantttitle{December}{4}
    \gantttitle{January}{4}
    \gantttitle{February}{4}
    \gantttitle{March}{4}
    \gantttitle{April}{4} \\
    \ganttbar{Study previous code}{3}{12} \\
    \ganttbar{Writing 1st rep.}{3}{4} 
    \ganttmilestone{}{4}\\
    \ganttbar{Writing 2nd rep.}{5}{7} 
    \ganttmilestone{}{7}\\
    \ganttbar{Writing research rep.}{6}{9} 
    \ganttmilestone{}{9}\\
    \ganttbar{Desktop application}{7}{12} \\
    \ganttbar{Tablet application}{10}{15} \\
    \ganttbar{Connecting applications}{9}{19} \\
    \ganttbar{Writing 3rd rep.}{18}{20} 
    \ganttmilestone{}{20}\\
    \ganttbar{Data analysis tools}{19}{25} \\
    \ganttbar{Writing final report}{20}{28} 
    \ganttmilestone{}{28}\\
    \ganttbar{Writing 4th rep.}{21}{23} 
    \ganttmilestone{}{23}\\
    \end{ganttchart}
    \end{landscape}

That is the only code on the page for the chart. I've also started a new project on ShareLatex and it does the same thing.

Best Answer

This is a solution where changes is shown by <---. Also, this solution uses landscape from geometry.

enter image description here

Code

\documentclass[]{article}
\usepackage{pgfgantt}
%\usepackage{pdflscape}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\begin{document}
%    \begin{landscape}
    \begin{ganttchart}[vgrid, hgrid]{1}{28}  % <---
    \gantttitle{2012}{12}
    \gantttitle{2013}{16} \\
    \gantttitle{October}{4}
    \gantttitle{November}{4}
    \gantttitle{December}{4}
    \gantttitle{January}{4}
    \gantttitle{February}{4}
    \gantttitle{March}{4}
    \gantttitle{April}{4} \\
    \ganttbar{Study previous code}{3}{12} \\
    \ganttbar{Writing 1st rep.}{3}{4} 
    \ganttmilestone{}{4}\\
    \ganttbar{Writing 2nd rep.}{5}{7} 
    \ganttmilestone{}{7}\\
    \ganttbar{Writing research rep.}{6}{9} 
    \ganttmilestone{}{9}\\
    \ganttbar{Desktop application}{7}{12} \\
    \ganttbar{Tablet application}{10}{15} \\
    \ganttbar{Connecting applications}{9}{19} \\
    \ganttbar{Writing 3rd rep.}{18}{20} 
    \ganttmilestone{}{20}\\
    \ganttbar{Data analysis tools}{19}{25} \\
    \ganttbar{Writing final report}{20}{28} 
    \ganttmilestone{}{28}\\
    \ganttbar{Writing 4th rep.}{21}{23} 
    \ganttmilestone{}{23}\\
    \end{ganttchart}
%    \end{landscape}
\end{document}