如何调整甘特图上的列宽

如何调整甘特图上的列宽

我已成功生成以下甘特图: 在此处输入图片描述

但是我希望列足够宽,以便我的 gantttitles 适合它们的列并且不会溢出,从而几乎无法阅读。这是我当前代码的片段:

\begin{landscape}
\begin{ganttchart}[vgrid, hgrid]{1}{20}

\gantttitle{\textsc{Quarter 2}}{10}
\gantttitle{\textsc{Quarter 3}}{10} \\
\gantttitle{Wk 1}{1}
\gantttitle{Wk 2}{1}
\gantttitle{Wk 3}{1}
\gantttitle{Wk 4}{1}
\gantttitle{Wk 5}{1}
\gantttitle{Wk 6}{1}
\gantttitle{Wk 7}{1}
\gantttitle{Wk 8}{1}
\gantttitle{Wk 9}{1}
\gantttitle{Wk 10}{1}
\gantttitle{Wk 1}{1}
\gantttitle{Wk 2}{1}
\gantttitle{Wk 3}{1}
\gantttitle{Wk 4}{1}
\gantttitle{Wk 5}{1}
\gantttitle{Wk 6}{1}
\gantttitle{Wk 7}{1}
\gantttitle{Wk 8}{1}
\gantttitle{Wk 9}{1}
\gantttitle{Wk 10}{1} \\
\ganttbar{Introduction}{1}{1} \\
\ganttbar{Literature Review}{2}{6} \\
\ganttbar{Prepare Proposal Structure}{3}{4}\\
\ganttbar{Proposal Due}{7}{7}
\ganttmilestone{}{7}\\
\ganttbar{Desktop application}{7}{12} \\
\ganttbar{Tablet application}{10}{15} \\
\ganttbar{Connecting applications}{9}{19} \\
\ganttbar{Final Draft for Review}{16}{18}\\
\ganttbar{Final Project Review}{19}{19}
\ganttmilestone{}{19}\\
\ganttbar{Final Report \& Presentation}{19}{20} 
\ganttmilestone{}{20}\\
\end{ganttchart}
\end{landscape}

答案1

您可以使用x unit设置时间段的宽度

\documentclass[tikz, border = 10pt]{standalone}

\usepackage{pgfgantt}

\begin{document}
\begin{ganttchart}[vgrid, hgrid, x unit=1cm]{1}{20}

  \gantttitle{\textsc{Quarter 2}}{10}
  \gantttitle{\textsc{Quarter 3}}{10} \\
  \gantttitle{Wk 1}{1}
  \gantttitle{Wk 2}{1}
  \gantttitle{Wk 3}{1}
  \gantttitle{Wk 4}{1}
  \gantttitle{Wk 5}{1}
  \gantttitle{Wk 6}{1}
  \gantttitle{Wk 7}{1}
  \gantttitle{Wk 8}{1}
  \gantttitle{Wk 9}{1}
  \gantttitle{Wk 10}{1}
  \gantttitle{Wk 1}{1}
  \gantttitle{Wk 2}{1}
  \gantttitle{Wk 3}{1}
  \gantttitle{Wk 4}{1}
  \gantttitle{Wk 5}{1}
  \gantttitle{Wk 6}{1}
  \gantttitle{Wk 7}{1}
  \gantttitle{Wk 8}{1}
  \gantttitle{Wk 9}{1}
  \gantttitle{Wk 10}{1} \\
  \ganttbar{Introduction}{1}{1} \\
  \ganttbar{Literature Review}{2}{6} \\
  \ganttbar{Prepare Proposal Structure}{3}{4}\\
  \ganttbar{Proposal Due}{7}{7}
  \ganttmilestone{}{7}\\
  \ganttbar{Desktop application}{7}{12} \\
  \ganttbar{Tablet application}{10}{15} \\
  \ganttbar{Connecting applications}{9}{19} \\
  \ganttbar{Final Draft for Review}{16}{18}\\
  \ganttbar{Final Project Review}{19}{19}
  \ganttmilestone{}{19}\\
  \ganttbar{Final Report \& Presentation}{19}{20} 
  \ganttmilestone{}{20}\\
\end{ganttchart}
\end{document}

在此处输入图片描述

相关内容