Is it possible to add text below the x-axis in a Gantt chart. For example, assume I have a simple Gantt chart with two tasks

\begin{ganttchart}[vgrid, hgrid]{12}
\gantttitle{Title}{12} \\
\ganttbar{Task 1}{0}{3} \\
\ganttbar{Task 2}{3}{10} 

I'd like to add text below some of the vertical grid lines in the Gantt chart. For example, below the vertical grid line where Task 1 ends I'd like to add the text "T_1" and add "T_2" below the vertical grid line where Task 2 starts. Is this possible?


Here's one way to do it using a variation of Paul Gessler's nice answer to How to draw a vertical line at a specified date in a Gantt chart?:


\@gtt@keydef{anyday offset}{1}
\@gtt@stylekeydef{anyday rule}{dashed, line width=1pt}
\@gtt@keydef{anyday label font}{\normalfont}
\@gtt@stylekeydef{anyday label node}{%
  anchor=north, font=\ganttvalueof{anyday label font}%


    \gtt@lasttitleline * \ganttvalueof{y unit title}%
    \gtt@lasttitleline * \ganttvalueof{y unit title}%
      + (\gtt@currentline - \gtt@lasttitleline - 1)%
      * \ganttvalueof{y unit chart}%
    (\gtt@anyday@slot - 1 + \ganttvalueof{anyday offset})%
      * \ganttvalueof{x unit}%
  \node [/pgfgantt/anyday label node]
     at (\x@mid pt, \y@lower pt) {#2};


\begin{ganttchart}[vgrid, hgrid]{1}{12}
\gantttitle{Title}{12} \\
\ganttbar{Task 1}{1}{3} \\
\ganttbar{Task 2}{3}{12}  \\


enter image description here

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.