大家好,我有一张甘特图,但我想让它看起来与我发布的图片类似。
\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 title
。ganttchart
添加几个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}