如何将 Gant 标题列表放在图表下方?

如何将 Gant 标题列表放在图表下方?

大家好,我有一张甘特图,但我想让它看起来与我发布的图片类似。

\documentclass[a4paper, 12pt,fleqn]{article} 
\usepackage{pgfgantt}

\begin{document}
\begin{figure}
\centering
\begin{ganttchart}[%
 inline, 
 bar inline label anchor=west,
 bar inline label node/.append style={anchor=west, text=white},
 bar/.append style={fill=cyan!90!black,}, 
 bar height=.8,]{0}{18}
 \gantttitlelist{0,...,18}{1}\\
\ganttbar[inline=false]{M1}{0}{3}
\ganttbar{J1}{0}{3}
\ganttbar{J2}{3}{4}
\ganttbar{}{5}{18}\\
\ganttbar[inline=false]{M2}{0}{5}
\ganttbar{J2}{5}{8}
\ganttbar{J1}{8}{12}
\ganttbar{}{12}{18}
\end{ganttchart}
\caption{To demonstrate Flow shop Scheduling}
\end{figure}
\end{document}

它应该是这样的

可以吗?pgfgantt或者我应该使用其他东西吗?我只想得到gantttitlelist下面的图表!

答案1

您只需将\gantttitlelist行移至底部即可。可以通过添加选项来调整标题行的垂直间距y unit titleganttchart添加几个draw=none选项并更改为无衬线字体会使结果更接近您显示的图形。

\documentclass[a4paper, 12pt,fleqn]{article} 
\usepackage{pgfgantt}

\begin{document}
\begin{figure}
\centering
{\sffamily
\begin{ganttchart}[%
 inline, 
 y unit title=1.1cm,
 canvas/.style={draw=none},
 title/.style={draw=none},
 bar inline label anchor=west,
 bar inline label node/.append style={anchor=west, text=white},
 bar/.append style={fill=cyan!90!black,}, 
 bar height=.8,]{0}{18}
\ganttbar[inline=false]{M1}{0}{3}
\ganttbar{J1}{0}{3}
\ganttbar{J2}{3}{4}
\ganttbar{}{5}{18}\\
\ganttbar[inline=false]{M2}{0}{5}
\ganttbar{J2}{5}{8}
\ganttbar{J1}{8}{12}
\ganttbar{}{12}{18}\\
\gantttitlelist{0,...,18}{1}
\end{ganttchart}
}
\caption{To demonstrate Flow shop Scheduling}
\end{figure}
\end{document}

在此处输入图片描述

相关内容