我想将甘特图的标题对齐到左侧。
但我希望数字(0、0.2、0.4 等)位于左侧,而不是中间。
有人知道怎么做吗?或者有没有比使用 pgfgantt 更好的方法?
我的代码如下所示:
\begin{ganttchart}[
expand chart=\textwidth,
]{1}{20}
[vgrid={draw=none, dotted}]{1}{20}
\gantttitle{0} {2}
\gantttitle{0.2}{2}
\gantttitle{0.4}{2}
\gantttitle{0.6}{2}
\gantttitle{0.8}{2}
\gantttitle{1.0}{2}
\gantttitle{1.2}{2}
\gantttitle{1.4}{2}
\gantttitle{1.6}{2}
\gantttitle{1.8}{2} \\
\ganttbar{Process 1}{4}{7} \\
\ganttbar{Process 2}{3}{6} \\
\end{ganttchart}
提前致谢!
答案1
将 0 转换为 0.0,因为我假设您想要与左侧相同的距离。
\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
title label node/.append style={anchor=east,xshift=1mm},
expand chart=\textwidth,
]{1}{20}
[vgrid={draw=none, dotted}]{1}{20}
%\gantttitle{0} {2}
\gantttitle{0.0} {2}
\gantttitle{0.2}{2}
\gantttitle{0.4}{2}
\gantttitle{0.6}{2}
\gantttitle{0.8}{2}
\gantttitle{1.0}{2}
\gantttitle{1.2}{2}
\gantttitle{1.4}{2}
\gantttitle{1.6}{2}
\gantttitle{1.8}{2} \\
\ganttbar{Process 1}{4}{7} \\
\ganttbar{Process 2}{3}{6} \\
\end{ganttchart}
\end{document}