我正在timeline
使用该软件包制作我的论文提案pgfgantt
,并且希望每个目标都使用不同的颜色条。这是当前版本。
\documentclass[12pt]{article}
\usepackage[margin=1.0in]{geometry}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
y unit title=0.5cm,
y unit chart=0.6cm,
time slot format=isodate-yearmonth,
compress calendar,
title/.append style={shape=rectangle, fill=black!10},
title height=1,
bar/.append style={fill=green!90},
bar height=.6,
bar label font=\normalsize\color{black!50},
group top shift=.6,
group height=.3,
group peaks height=.2,
bar incomplete/.append style={fill=green!40}
]{2015-05}{2017-06}
\gantttitlecalendar{year} \\
\gantttitlecalendar{month} \\
\ganttset{progress label text={}} % this suppresses percentage done labels
\ganttgroup{Aim 1: Phenotypes}{2015-06}{2015-12} \\
\ganttbar[progress=00, name=rclone]{R cloning}{2015-06}{2015-07} \\
\ganttlinkedbar[progress=00, name=rflr]{R fluorescence}{2015-07}{2015-09} \\
\ganttlinkedbar[progress=00, name=rqpcr]{R RT-qPCR}{2015-10}{2015-11} \\
\ganttbar[progress=00, name=kover]{KO verification}{2015-06}{2015-07} \\
\ganttlinkedbar[progress=00, name=kogro]{KO growth}{2015-08}{2015-09} \\
\ganttbar[progress=00, name=koflr]{KO fluorescence}{2015-08}{2015-09} \\
\ganttlinkedbar[progress=00, name=koo2]{KO O2 evolution}{2015-10}{2015-11} \\
\ganttgroup{Aim 2: Expression}{2015-06}{2017-02} \\
\ganttbar[progress=00, name=oeclone]{Clone OEs}{2016-01}{2016-03} \\
\ganttbar[progress=00, name=rnagrow]{Grow KOs + OEs}{2016-04}{2016-06} \\
\ganttlinkedbar[progress=00, name=rnaprep]{RNA library prep}{2016-07}{2016-09} \\
\ganttbar[progress=00, name=rnadev]{Develop analysis}{2015-06}{2015-07} \\
\ganttbar[progress=00, name=rnaanal]{Analyze reads}{2016-12}{2017-02} \\
\ganttgroup{Aim 3: Binding sites}{2016-01}{2017-05} \\
\ganttbar[progress=00, name=chipgrow]{Grow KOs + OEs}{2016-04}{2016-06} \\
\ganttlinkedbar[progress=00, name=chipprep]{ChIP library prep}{2016-08}{2016-12} \\
\ganttbar[progress=00, name=chipdev]{Develop analysis}{2016-01}{2016-02} \\
\ganttbar[progress=00, name=chipanal]{Analyze reads}{2017-03}{2017-05}
% misc links
\ganttset{progress label text={}}
\ganttlink[]{oeclone}{rnagrow}
\ganttlink[link mid=0.082]{oeclone}{chipgrow}
\ganttlink[]{rnaprep}{rnaanal}
\ganttlink[link mid=0.25]{kover}{koflr}
\ganttlink[link mid=0.75]{kogro}{koo2}
\ganttlink[link mid=0.55]{koo2}{oeclone}
\ganttlink[link mid=0.55]{rqpcr}{oeclone}
\ganttlink[]{chipprep}{chipanal}
\ganttlink[link mid=0.938]{rnadev}{rnaanal}
\ganttlink[link mid=0.915]{chipdev}{chipanal}
\end{ganttchart}
\end{document}
例如,我怎样才能实现目标 1 green
、目标 2red
和目标 3 ?blue
答案1
\ganttset
在中间添加s,例如:
\ganttset{bar incomplete/.append style={fill=red!40},
group/.append style={draw=black, fill=red},}
代码:
\documentclass[12pt]{article}
\usepackage[margin=1.0in]{geometry}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
y unit title=0.5cm,
y unit chart=0.6cm,
time slot format=isodate-yearmonth,
compress calendar,
title/.append style={shape=rectangle, fill=black!10},
title height=1,
bar/.append style={fill=green!90},
bar height=.6,
bar label font=\normalsize\color{black!50},
group top shift=.6,
group height=.3,
group peaks height=.2,
bar incomplete/.append style={fill=green!40}
]{2015-05}{2017-06}
\gantttitlecalendar{year} \\
\gantttitlecalendar{month} \\
\ganttset{progress label text={},
bar incomplete/.append style={fill=green!40},
group/.append style={draw=black, fill=green},} % this suppresses percentage done labels
\ganttgroup{Aim 1: Phenotypes}{2015-06}{2015-12} \\
\ganttbar[progress=00, name=rclone]{R cloning}{2015-06}{2015-07} \\
\ganttlinkedbar[progress=00, name=rflr]{R fluorescence}{2015-07}{2015-09} \\
\ganttlinkedbar[progress=00, name=rqpcr]{R RT-qPCR}{2015-10}{2015-11} \\
\ganttbar[progress=00, name=kover]{KO verification}{2015-06}{2015-07} \\
\ganttlinkedbar[progress=00, name=kogro]{KO growth}{2015-08}{2015-09} \\
\ganttbar[progress=00, name=koflr]{KO fluorescence}{2015-08}{2015-09} \\
\ganttlinkedbar[progress=00, name=koo2]{KO O2 evolution}{2015-10}{2015-11} \\
\ganttset{bar incomplete/.append style={fill=red!40},
group/.append style={draw=black, fill=red},}
\ganttgroup{Aim 2: Expression}{2015-06}{2017-02} \\
\ganttbar[progress=00, name=oeclone]{Clone OEs}{2016-01}{2016-03} \\
\ganttbar[progress=00, name=rnagrow]{Grow KOs + OEs}{2016-04}{2016-06} \\
\ganttlinkedbar[progress=00, name=rnaprep]{RNA library prep}{2016-07}{2016-09} \\
\ganttbar[progress=00, name=rnadev]{Develop analysis}{2015-06}{2015-07} \\
\ganttbar[progress=00, name=rnaanal]{Analyze reads}{2016-12}{2017-02} \\
\ganttset{bar incomplete/.append style={fill=blue!40},
group/.append style={draw=black, fill=blue},}
\ganttgroup{Aim 3: Binding sites}{2016-01}{2017-05} \\
\ganttbar[progress=00, name=chipgrow]{Grow KOs + OEs}{2016-04}{2016-06} \\
\ganttlinkedbar[progress=00, name=chipprep]{ChIP library prep}{2016-08}{2016-12} \\
\ganttbar[progress=00, name=chipdev]{Develop analysis}{2016-01}{2016-02} \\
\ganttbar[progress=00, name=chipanal]{Analyze reads}{2017-03}{2017-05}
% misc links
\ganttset{progress label text={}}
\ganttlink[]{oeclone}{rnagrow}
\ganttlink[link mid=0.082]{oeclone}{chipgrow}
\ganttlink[]{rnaprep}{rnaanal}
\ganttlink[link mid=0.25]{kover}{koflr}
\ganttlink[link mid=0.75]{kogro}{koo2}
\ganttlink[link mid=0.55]{koo2}{oeclone}
\ganttlink[link mid=0.55]{rqpcr}{oeclone}
\ganttlink[]{chipprep}{chipanal}
\ganttlink[link mid=0.938]{rnadev}{rnaanal}
\ganttlink[link mid=0.915]{chipdev}{chipanal}
\end{ganttchart}
\end{document}