甘特图条形标签间距问题

甘特图条形标签间距问题

在此处输入图片描述在此处输入图片描述 我花了一段时间才首先在甘特图上找到正确的间距 - 如果我能找到一种方法将整个图表向左移动,那就更容易了,但我找不到方法,我试过了,flushleft但这不起作用..请参阅第一个附件

无论如何,一旦我插入甘特图条形标签,它就完全搞乱了,请参阅附件-我已经尝试了inline=trueinline=false

我只是想将它们放置在左侧或我不介意的条形图顶部,但只要保持整个甘特图的间距不变。

非常感谢。

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

(下面使用的代码)。

\documentclass{article}
% Uncomment the following line to allow the usage of graphics (.png, .jpg)
%\usepackage[pdftex]{graphicx}
% Comment the following line to NOT allow the usage of umlauts
\usepackage{pgfgantt}
\usepackage{graphicx}


% Start the document

\usepackage{xcolor}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}

     \begin{ganttchart}[
     y unit title=0.5cm,
     y unit chart=0.7cm,
     vgrid,hgrid,
     title height=1,
     title/.style={fill=none},
     title label font=\bfseries\footnotesize,
     bar/.style={fill=cyan},
     bar height=0.7,
   progress label text={},
     group right shift=0,
     group top shift=0.7,
     group height=.3,
     group peaks width={0.2},
     inline]{1}{29}
    %labels

 % title 1
    \gantttitle{2020}{3}
 \gantttitle{2021}{9}        
 \gantttitle{2022}{9}                         % title 2
    \gantttitle{2023}{9} \\              
    \gantttitle{Q4}{2}                      % title 3
  
 \gantttitle{Q1}{3}                      % title 3
    \gantttitle{Q2}{3}
\gantttitle{Q3}{3}
 \gantttitle{Q1}{3}                      % title 3
    \gantttitle{Q2}{3}
\gantttitle{Q3}{3}
 \gantttitle{Q1}{3}                      % title 3
    \gantttitle{Q2}{3}
\gantttitle{Q3}{3}\\
    % Setting group if any
 
    \ganttbar[progress=100,inline=false]{Background monitoring of the literature}{1}{4}\\
 \ganttbar[progress=100,inline=false]{Carry out and complete literature review on sessile droplet dynamics}{1}{4}\\
  


    \ganttbar[progress=100,inline=false]{Incorporation of moving contact line into WIBL model}{1}{9} \\

    \ganttbar[progress=100,inline=false]{{Modelling and validation of inertial sliding \\ droplet impacts on solid surfaces}}{2}{6} \\
  

  
    \ganttbar[progress=100,inline=false]{Derivation of higher order (3rd and 4th) WIBL models}{2}{6}\\ 
    \ganttbar[progress=100,inline=false]{Development of efficient time integration scheme test against problems of solitary waves on falling films}{2}{6} \\ 
\ganttbar[progress=100,inline=false]{Modelling and validation of droplet impacts on solid surfaces}{8}{10} \\ 
\ganttbar[progress=100,inline=false]{Development of efficient time-integration scheme}{8}{10} \\ 
\ganttbar[progress=100,inline=false]{Paper preperation and submission}{8}{10} \\ 
\ganttbar[progress=100,inline=false]{Modelling and validation of intertial sliding droplets on solid surfaces}{1}{4} \\ 
\ganttbar[progress=100,inline=false]{Paper preparation and submission}{1}{4} \\
\ganttbar[progress=100,inline=false]{Thesis writing and submission}{8}{10}\\
\ganttbar[progress=100,inline=false]{Oral exam}{1}{4}\\


  
\end{ganttchart}
    \caption{Gantt chart showing PhD activity time lines over four month intervals beyond the progression review.}


\end{figure}
\end{document}

答案1

以下是三个不同的版本:

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

\documentclass{article}

\usepackage{pgfgantt}
\usepackage{graphicx}
\usepackage{pdflscape}



% Start the document

\usepackage{xcolor}
\usetikzlibrary{positioning}

\usepackage{enumitem}

\begin{document}

\begin{figure}

\begin{ganttchart}[
     y unit title=0.5cm,
     y unit chart=0.7cm,
     x unit=0.4cm,
     vgrid,hgrid,
     title height=1,
     title/.style={fill=none},
     title label font=\bfseries\footnotesize,
     bar/.style={fill=cyan},
     bar height=0.7,
     progress label text={},
     group right shift=0,
     group top shift=0.7,
     group height=.3,
     group peaks width={0.2},
     inline]{1}{29}

  \gantttitle{2020}{3}
  \gantttitle{2021}{9}        
  \gantttitle{2022}{9}                        
  \gantttitle{2023}{9} \\
              
  \gantttitle{Q4}{2}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}\\
 
  \ganttbar[progress=100,inline=false]{1)}{1}{4}   \\
  \ganttbar[progress=100,inline=false]{2)}{1}{4}   \\
  \ganttbar[progress=100,inline=false]{3)}{1}{9}   \\
  \ganttbar[progress=100,inline=false]{4)}{2}{6}   \\
  \ganttbar[progress=100,inline=false]{5)}{2}{6}   \\ 
  \ganttbar[progress=100,inline=false]{6)}{2}{6}   \\ 
  \ganttbar[progress=100,inline=false]{7)}{8}{10}  \\ 
  \ganttbar[progress=100,inline=false]{8)}{8}{10}  \\ 
  \ganttbar[progress=100,inline=false]{9)}{8}{10}  \\ 
  \ganttbar[progress=100,inline=false]{10)}{1}{4}  \\ 
  \ganttbar[progress=100,inline=false]{11)}{1}{4}  \\
  \ganttbar[progress=100,inline=false]{12)}{8}{10} \\
  \ganttbar[progress=100,inline=false]{13)}{1}{4}
 
\end{ganttchart}

\begin{enumerate}[nosep, label=\arabic*)]
  \item Background monitoring of the literature
  \item Carry out and complete literature review on sessile droplet dynamics
  \item Incorporation of moving contact line into WIBL model
  \item Modelling and validation of inertial sliding droplet impacts on solid surfaces
  \item Derivation of higher order (3rd and 4th) WIBL models
  \item Development of efficient time integration scheme test against problems of solitary waves on falling films
  \item Modelling and validation of droplet impacts on solid surfaces
  \item Development of efficient time-integration scheme
  \item Paper preperation and submission
  \item Modelling and validation of intertial sliding droplets on solid surfaces
  \item Paper preparation and submission
  \item Thesis writing and submission
  \item Oral exam
\end{enumerate}

\caption{Gantt chart showing PhD activity time lines over four month intervals beyond the progression review.}

\end{figure}



\begin{figure}

     \begin{ganttchart}[
     y unit title=0.5cm,
     y unit chart=1.25cm,
     x unit =0.25cm,
     vgrid,hgrid,
     title height=1,
     title/.style={fill=none},
     title label font=\bfseries\footnotesize,
     bar/.style={fill=cyan},
     bar height=0.7,
     progress label text={},
     group right shift=0,
     group top shift=0.7,
     group height=.3,
     group peaks width={0.2},
     inline, 
     bar label node/.style={text width=4.25cm,
                            align=right,
                            anchor=east,
                            font=\footnotesize\raggedleft}
    ]{1}{29}

  \gantttitle{2020}{3}
  \gantttitle{2021}{9}        
  \gantttitle{2022}{9}                        
  \gantttitle{2023}{9} \\
              
  \gantttitle{Q4}{2}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}\\
 
  \ganttbar[progress=100,inline=false]{Background monitoring of the literature}{1}{4}\\
  \ganttbar[progress=100,inline=false]{Carry out and complete literature review on sessile droplet dynamics}{1}{4}\\
  \ganttbar[progress=100,inline=false]{Incorporation of moving contact line into WIBL model}{1}{9} \\
  \ganttbar[progress=100,inline=false]{{Modelling and validation of inertial sliding \\ droplet impacts on solid surfaces}}{2}{6} \\
  \ganttbar[progress=100,inline=false]{Derivation of higher order (3rd and 4th) WIBL models}{2}{6}\\ 
  \ganttbar[progress=100,inline=false]{Development of efficient time integration scheme test against problems of solitary waves on falling films}{2}{6} \\ 
  \ganttbar[progress=100,inline=false]{Modelling and validation of droplet impacts on solid surfaces}{8}{10} \\ 
  \ganttbar[progress=100,inline=false]{Development of efficient time-integration scheme}{8}{10} \\ 
  \ganttbar[progress=100,inline=false]{Paper preperation and submission}{8}{10} \\ 
  \ganttbar[progress=100,inline=false]{Modelling and validation of intertial sliding droplets on solid surfaces}{1}{4} \\ 
  \ganttbar[progress=100,inline=false]{Paper preparation and submission}{1}{4} \\
  \ganttbar[progress=100,inline=false]{Thesis writing and submission}{8}{10}\\
  \ganttbar[progress=100,inline=false]{Oral exam}{1}{4}

\end{ganttchart}
    \caption{Gantt chart showing PhD activity time lines over four month intervals beyond the progression review.}

\end{figure}


\begin{landscape}

\begin{figure}

     \begin{ganttchart}[
     y unit title=0.5cm,
     y unit chart=0.8cm,
     x unit =0.4cm,
     vgrid,hgrid,
     title height=1,
     title/.style={fill=none},
     title label font=\bfseries\footnotesize,
     bar/.style={fill=cyan},
     bar height=0.7,
     progress label text={},
     group right shift=0,
     group top shift=0.7,
     group height=.3,
     group peaks width={0.2},
     inline, 
     bar label node/.style={text width=7cm,
                            align=right,
                            anchor=east,
                            font=\footnotesize\raggedleft}
    ]{1}{29}

  \gantttitle{2020}{3}
  \gantttitle{2021}{9}        
  \gantttitle{2022}{9}                        
  \gantttitle{2023}{9} \\
              
  \gantttitle{Q4}{2}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}
  \gantttitle{Q1}{3}
  \gantttitle{Q2}{3}
  \gantttitle{Q3}{3}\\
 
  \ganttbar[progress=100,inline=false]{Background monitoring of the literature}{1}{4}\\
  \ganttbar[progress=100,inline=false]{Carry out and complete literature review on sessile droplet dynamics}{1}{4}\\
  \ganttbar[progress=100,inline=false]{Incorporation of moving contact line into WIBL model}{1}{9} \\
  \ganttbar[progress=100,inline=false]{{Modelling and validation of inertial sliding \\ droplet impacts on solid surfaces}}{2}{6} \\
  \ganttbar[progress=100,inline=false]{Derivation of higher order (3rd and 4th) WIBL models}{2}{6}\\ 
  \ganttbar[progress=100,inline=false]{Development of efficient time integration scheme test against problems of solitary waves on falling films}{2}{6} \\ 
  \ganttbar[progress=100,inline=false]{Modelling and validation of droplet impacts on solid surfaces}{8}{10} \\ 
  \ganttbar[progress=100,inline=false]{Development of efficient time-integration scheme}{8}{10} \\ 
  \ganttbar[progress=100,inline=false]{Paper preperation and submission}{8}{10} \\ 
  \ganttbar[progress=100,inline=false]{Modelling and validation of intertial sliding droplets on solid surfaces}{1}{4} \\ 
  \ganttbar[progress=100,inline=false]{Paper preparation and submission}{1}{4} \\
  \ganttbar[progress=100,inline=false]{Thesis writing and submission}{8}{10}\\
  \ganttbar[progress=100,inline=false]{Oral exam}{1}{4}
  
\end{ganttchart}
    \caption{Gantt chart showing PhD activity time lines over four month intervals beyond the progression review.}

\end{figure}

\end{landscape}


\end{document}

相关内容