% \documentclass[4paper,11pt]{article}
\documentclass{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\definecolor{phd1}{rgb}{0.125490196078431,0.290196078431373,0.529411764705882}     % phd1
% \definecolor{master2}{rgb}{0.96078431372549,0.474509803921569,0}                   % master2
\definecolor{postdoc}{rgb}{0.305882352941176,0.603921568627451,0.0235294117647059}  % postdoc
\definecolor{phd2}{rgb}{0.6431372549019608, 0.0, 0.0}                            % phd2
\definecolor{postdoc2}{rgb}{0.4588235294117647, 0.3137254901960784, 0.4823529411764706}  % Purple
% \definecolor{leader}{HTML}{babdb6} % nice gray
\definecolor{leader}{HTML}{edd400}

% \definecolor{leader}{rgb}{0.480392156862745,0.503921568627451,0.511764705882353}  % grey
    % \definecolor{leader}{rgb}{0.180392156862745,0.203921568627451,0.211764705882353}    
    % \definecolor{leader}{rgb}{0.447058823529412,0.623529411764706,0.811764705882353}    
    \definecolor{master2}{rgb}{0.807843137254902,0.36078431372549,0}
    % \definecolor{leader}{rgb}{0.541176470588235,0.886274509803922,0.203921568627451}    
    % \definecolor{color9}{rgb}{0.937254901960784,0.16078431372549,0.16078431372549}    
    % \definecolor{color10}{rgb}{0.67843137254902,0.498039215686275,0.658823529411765}    
    % \definecolor{color11}{rgb}{0.125490196078431,0.290196078431373,0.529411764705882}    
    % \definecolor{color12}{rgb}{0.96078431372549,0.474509803921569,0}    
    % \definecolor{leader}{rgb}{0.305882352941176,0.603921568627451,0.0235294117647059}    
    % \definecolor{leader}{rgb}{0.6431372549019608, 0.0, 0.0}    
    % \definecolor{leader}{rgb}{0.4588235294117647, 0.3137254901960784, 0.4823529411764706}    
    % \definecolor{leader}{rgb}{0.180392156862745,0.203921568627451,0.211764705882353}

\usetikzlibrary{patterns.meta}

\usepackage{pgfgantt}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\makeatletter
\newlength\pgf@pat@distance % or defined by the more portable \newdimen

% based on pattern `Lines`, defined in pgflibrarypatterns.meta.code.tex
\pgfdeclarepattern{
  name=Stripes,
  type=colored,
  parameters={
      \pgfkeysvalueof{/pgf/pattern keys/distance},
      \pgfkeysvalueof{/pgf/pattern keys/angle},
      \pgfkeysvalueof{/pgf/pattern keys/xshift},
      \pgfkeysvalueof{/pgf/pattern keys/yshift},
      \pgfkeysvalueof{/pgf/pattern keys/color series},
  },
  bottom left={%
    \pgfpoint{-.5*\pgf@pat@distance}{-.5*\pgf@pat@distance}},
  top right={%
    \pgfpoint{.5*\pgf@pat@distance}{.5*\pgf@pat@distance}},
  tile size={%
    \pgfpoint
      {\pgfkeysvalueof{/pgf/pattern keys/distance}}%
      {\pgfkeysvalueof{/pgf/pattern keys/distance}}},
  tile transformation={%
    \pgftransformshift{%
      \pgfpoint
        {\pgfkeysvalueof{/pgf/pattern keys/xshift}}%
        {\pgfkeysvalueof{/pgf/pattern keys/yshift}}}%
    \pgftransformrotate{\pgfkeysvalueof{/pgf/pattern keys/angle}}},
  defaults={
    distance/.initial=6pt,
    angle/.initial=0,
    xshift/.initial=0pt,
    yshift/.initial=0pt,
    color series/.initial={phd2,postdoc,phd1},
  },
  code={%
    \pgf@pat@colorseries@parse
    % set line width
    \pgfsetlinewidth{\pgf@pat@distance/\pgfutil@tempcnta}%
    % \pgfutil@tempdima holds the y-coord of a stripe
    \pgfutil@tempdima=\dimexpr-.5\pgf@pat@distance+.5\pgflinewidth\relax
    % draw stripes
    \pgfutil@tempcnta=0
    \pgfutil@for\pgf@pat@temp:=\pgf@pat@colorseries\do{%
      \ifx\pgf@pat@temp\pgfutil@empty
      \else
        \pgfsetstrokecolor{\pgf@pat@temp}%
        \pgfpathmoveto{%
          \pgfpoint{-.5*\pgf@pat@distance}{\pgfutil@tempdima}}%
        \pgfpathlineto{%
          \pgfpoint{ .5*\pgf@pat@distance}{\pgfutil@tempdima}}%
        \pgfusepath{stroke}%
        \advance\pgfutil@tempdima\pgflinewidth
      \fi
    }%
  },
  set up code={%
    \pgfmathsetlength{\pgf@pat@distance}{\pgfkeysvalueof{/pgf/pattern keys/distance}}%
  }
}

% util
\def\pgf@pat@colorseries@parse{%
  % prepare \pgf@pat@colorseries and store its length in \pgfutil@tempcnta
  \let\pgf@pat@colorseries\pgfutil@empty
  \pgfutil@tempcnta=0
  \pgfkeysgetvalue{/pgf/pattern keys/color series}{\pgf@pat@colorseries@temp}%
  \pgfutil@for\pgf@temp:=\pgf@pat@colorseries@temp\do{%
    % strip spaces around color names and skip empty items
    % the total effect is to convert `phd2, phd1,, cyan` to `phd2,phd1,cyan`
    \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
    \ifx\pgf@temp\pgfutil@empty
    \else
      \edef\pgf@pat@colorseries{%
        \unexpanded\expandafter{\pgf@pat@colorseries},%
        \unexpanded\expandafter{\pgf@temp}}%
      \advance\pgfutil@tempcnta by 1
    \fi
  }%
  % ensure the resulting color series is never empty
  \ifnum\pgfutil@tempcnta=0
    \def\pgf@pat@colorseries{phd2,postdoc,phd1}%
  \fi
}
\makeatother

\begin{document}
% \begin{tikzpicture}
%   \fill[pattern={Lines[angle=30]}]
%     (0,0) rectangle +(2,1);
%
%   \fill[pattern={Stripes[angle=30]}]
%     (0,-1.5) rectangle +(2,1);
%   \fill[pattern={Stripes[angle=30, color series={leader, darkleader}]}]
%     (3,-1.5) rectangle +(2,1);
%   \fill[pattern={Stripes[angle=30, distance=12pt, color series={cyan, magenta, master1, black}]}]
%     (6,-1.5) rectangle +(2,1);
%   \fill[pattern={Stripes[angle=30, distance=12pt, color series={cyan!50!black!50}]}]
%     (9,-1.5) rectangle +(2,1);
% \end{tikzpicture}
% \bigskip

% helper option
\pgfqkeys{/pgfgantt}{
  bar pattern/.style={
    bar/.append style={
      pattern={Stripes[angle=45,distance=15pt,color series={#1}]}
    }
  },
  bar pattern/.default={phd2,postdoc,phd1},
}
% \newpage
% \vspace{-4cm}
\noindent
\begin{tikzpicture}
\begin{ganttchart}[expand chart=17cm,
            vgrid={*2{draw=none},{dotted}},
            y unit title=0.6cm,
            y unit chart=0.5cm,
                                title height=1,
                bar height=0.6]{1}{36}
  \gantttitle[]{Year 1}{6}
  \gantttitle[]{Year 2}{6}
  \gantttitle[]{Year 3}{6}
  \gantttitle[]{Year 4}{6}
  \gantttitle[]{Year 5}{6}
  \gantttitle[]{Year 6}{6}\\
%   ich leader, postdoc grün, phd1 phd1, phd2 phd2, master 1 master1, master2 master2

  \ganttbar[bar pattern={leader}]{WP A1.1}{1}{6}                \\
  \ganttbar[bar pattern={leader}]{WP A1.2}{1}{6}\ganttbar[bar pattern={phd1}]{}{7}{12}  \\
  \ganttbar[bar pattern={leader}]{WP A2.1}{1}{6} \ganttbar[bar pattern={postdoc}]{}{7}{9} \\
  \ganttbar[bar pattern={phd1}]{WP A2.2}{4}{15}                \\
  \ganttbar[bar pattern={leader}]{WP A2.3}{4}{6}   \ganttbar[bar pattern={leader,postdoc}]{}{7}{18} \\
    \ganttbar[bar pattern={postdoc}]{WP A3\phantom{.1}}{7}{18}
    \ganttnewline[ black]
  \ganttbar[bar pattern={phd1}]{WP B1.1}{1}{12}                \\
  \ganttbar[bar pattern={leader,phd1}]{WP B1.2}{10}{18}                \\
%   \ganttbar[bar pattern={leader,phd1}]{WP B1c}{10}{18}                \\
  \ganttbar[bar pattern={phd1}]{WP B2.1}{1}{12}                \\
  \ganttbar[bar pattern={leader}]{WP B2.2}{10}{18}                \\
  \ganttbar[bar pattern={leader}]{WP B2.3}{16}{18}  \ganttbar[bar pattern={postdoc2}]{}{19}{21}                 \\
  \ganttbar[bar pattern={leader, postdoc2}]{WP B3\phantom{.1}}{19}{24}
    \ganttnewline[ black]
  \ganttbar[bar pattern={leader}]{WP C1.1}{16}{27}                \\
  \ganttbar[bar pattern={postdoc2}]{WP C1.2}{19}{27} \\
  \ganttbar[bar pattern={leader}]{WP C2.1}{16}{27}              \\
  \ganttbar[bar pattern={postdoc2}]{WP C2.2}{19}{30} \\
    \ganttbar[bar pattern={phd2}]{WP C3\phantom{.1}}{16}{30}                \\
  \ganttbar[bar pattern={phd2, postdoc2, leader}]{WP C4.1}{25}{30}\ganttbar[bar pattern={phd2,leader}]{}{31}{33}\ganttbar[bar pattern={leader}]{}{34}{36}              \\
  \ganttbar[bar pattern={phd2, leader}]{WP C4.2}{31}{33} \ganttbar[bar pattern={leader}]{}{34}{36}
  \ganttnewline[very thick, black]
  \ganttbar[bar pattern={leader}]{Group leader}{1}{36}           \\
  \ganttbar[bar pattern={phd1}]{PhD 1}{1}{18}           \\
  \ganttbar[bar pattern={postdoc}]{Postdoc 1}{7}{18}           \\
  \ganttbar[bar pattern={phd2}]{PhD 2}{16}{33}       \\
  \ganttbar[bar pattern={postdoc2}]{Postdoc 2}{19}{30}          %\\
%   \ganttbar[bar pattern={master1}]{Master 1}{16}{21}           \\
%   \ganttbar[bar pattern={master2}]{Master 2}{31}{36}
%
%
%   \ganttbar[bar pattern={leader, postdoc}]{WP2}{4}{15} \ganttbar[bar pattern={postdoc}]{WP2}{15}{30}  \\
%   \ganttbar[bar pattern={phd1, phd2}]{WP3}{10}{30}   \\
%   \ganttbar[bar pattern={phd2}]{WP4}{20}{45}
\end{ganttchart}
    \node at (14.1, -2.1) {\textbf{WP A}};
    \node at (14.1, -5.2) {\textbf{WP B}};
    \node at (14.1, -8.3) {\textbf{WP C}};
\end{tikzpicture}
\end{document}
