# How to create a Gant-Chart in LaTeX-Beamer

I am trying to create a Gant-Chart in Beamer. I found the following example:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage{pgfgantt}

\title{Sample title}
\author{Anonymous}
\institute{Overleaf}
\date{2019}

\begin{document}

\frame{\titlepage}
\begin{frame}{Gant-Chart}
\begin{ganttchart}[vgrid, hgrid,
bar/.append style={fill=blue!80},
milestone/.append style={fill=green}]{1}{15}
\gantttitle{2019}{15} \\
\gantttitlelist{1,...,15}{1} \\
\ganttmilestone{Milestone}{7} \ganttnewline
\end{ganttchart}
\end{frame}

\end{document}


Now, I want to change it slightly. The first row shows the year. I want the second row to show months. And then the third row shows the number of weeks that I have planned for the task. Also, I don't want to see any arrows, but just have the rectangles. Is there a way to add a grid? Basically I want everything to just look as in an Excel-Table: Grids and then color the rectangles during which I am working.

Here is an example of what I would like to have:

Can somebody show me how to do this?

Here is another example that seems to get pretty close to what I want. Only in the week-row now it is always written "week 1", "week 2" and so on. I just want the number.

\begin{frame}
\begin{figure}[h!bt]
\begin{center}
\begin{ganttchart}[
vgrid={*{6}{draw=none}, dotted},
x unit=.08cm,
y unit title=.6cm,
y unit chart=.6cm,
time slot format=isodate,
time slot format/start date=2019-02-01]{2019-02-01}{2019-07-31}
\ganttset{bar height=.6}
\gantttitlecalendar{year, month=name, week} \\
\end{ganttchart}
\end{center}
\caption{Time Plan}
\end{figure}
\end{frame}

• could you add an example image of what you desire? Feb 15, 2019 at 11:38
• The manual of the pgfgantt package provides examples for most of your requirements. Feb 15, 2019 at 13:03
• @Raaja: I have added an example. If you know how to get such an image in my beamer presentation, I'd be very happy!
– Luk
Feb 17, 2019 at 10:35
• So, I have found another example and added it to my question. I really don't know how to proceed now, this should be possible, shouldn't it?
– Luk
Feb 17, 2019 at 20:07
• What is the difference to tex.stackexchange.com/questions/475380/…? Feb 18, 2019 at 6:23

A starting point for you could be:

\documentclass{standalone}

\usepackage[utf8]{inputenc}
\usepackage{pgfgantt}

\begin{document}

\begin{ganttchart}[
hgrid,
vgrid={*{6}{draw=none}, dotted},
x unit=0.125cm,
time slot format=isodate,
time slot unit=day,
calendar week text = {W\currentweek{}},
bar height = 1, %necessary to make it fit the height
bar top shift = -0.01, %to move it inside the grid space ;)
]{2019-01-01}{2019-06-30}
\gantttitlecalendar{year, month=name, week} \\
\ganttbar[bar/.append style={fill=red}]{Start}{2019-01-01}{2019-01-07}\\
\ganttbar[bar/.append style={fill=yellow}]{A}{2019-01-08}{2019-01-14}\\
\ganttbar[bar/.append style={fill=cyan}]{A}{2019-01-15}{2019-01-21}\\
\ganttbar[bar/.append style={fill=green}]{Finish phase 1}{2019-01-22}{2019-01-28}
\end{ganttchart}

\end{document}


which gives:

However, note that you can customise these gantt charts as much as you desire. Just have a look indie the pgfgantt package documentation ;-).

PS: (As @Johannes_B pointed out) please do not add redundant questions if you haven't received an answer for a question.

Next, to fit it inside your beamer frame, you can use adjustbox package in your preamble and insert this snippet as in:

    \frame{\titlepage}
\begin{frame}{Gant-Chart}
\begin{ganttchart}[
hgrid,
vgrid={*{6}{draw=none}, dotted},
x unit=0.125cm,
time slot format=isodate,
time slot unit=day,
calendar week text = {W\currentweek{}},
bar height = 1, %necessary to make it fit the height
bar top shift = -0.01, %to move it inside the grid space ;)
]{2019-01-01}{2019-06-30}
\gantttitlecalendar{year, month=name, week} \\
\ganttbar[bar/.append style={fill=red}]{Start}{2019-01-01}{2019-01-07}\\
\ganttbar[bar/.append style={fill=yellow}]{A}{2019-01-08}{2019-01-14}\\
\ganttbar[bar/.append style={fill=cyan}]{A}{2019-01-15}{2019-01-21}\\
\ganttbar[bar/.append style={fill=green}]{Finish phase 1}{2019-01-22}{2019-01-28}
\end{ganttchart}

• a last question maybe: Can you explain to me what the draw-none option in vgrid={*{6}{draw=none},{dotted}} is for? I figured the number states how many vertical lines I want to have. Should there be more columns than numbers, the drawing repeats (as in a loop). Then comes the style of the vgrid, such as color, or dotted. But draw-none ?