我正在尝试弄清楚如何用从中心向外逐渐变淡的水平颜色渐变填充 pgfgantt 条。不幸的是,我没有运气!
我想知道是否有人知道如何做到这一点?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfgantt}
\usepackage{xcolor,colortbl}
\definecolor{calendar_col}{RGB}{237,247,224}
\definecolor{color_a}{RGB}{140,102,25}
\definecolor{color_b}{RGB}{236,234,188}
\definecolor{color_c}{RGB}{98,113,140}
\begin{document}
\begin{ganttchart}[vgrid,
inline,
title/.append style = {draw = black, fill = calendar_col},
group/.append style = {draw = black, shape=ganttgroup, inner sep=0pt, fill = black},
group left shift = 0,
group right shift = 0,
group height = 0.05,
group peaks tip position = 0,
group peaks width = 0.2,
group peaks height = 0.2,
y unit chart = 0.6cm,
bar height = 0.7,
bar top shift = -0.2,
canvas/.style = {fill = calendar_col},
expand chart = \textwidth,
time slot format= isodate-yearmonth,
time slot unit = month]{2021-01}{2021-12}
\gantttitlecalendar{month = shortname} \\
\ganttgroup[group inline label node/.style={above=-5pt, font=\bfseries\color{black}}]{Year 1}{2021-06}{2021-06} \\
\ganttbar[bar/.append style = {fill = color_a}]{A}{2021-06}{2021-06} \\
\ganttgroup[group inline label node/.style={above=-5pt, font=\bfseries\color{black}}]{Year 2}{2021-03}{2021-03} \\
\ganttbar[bar/.append style = {fill = color_b}]{B}{2021-03}{2021-03} \\
\ganttgroup[group inline label node/.style={above=-5pt, font=\bfseries\color{black}}]{Year 3}{2021-01}{2021-09} \\
\ganttbar[bar/.append style = {fill = color_c}]{C}{2021-01}{2021-09}
\end{ganttchart}
\end{document}
以上是我制作的图表类型的最小可重现示例。理想情况下,我可以定义 RGB 颜色,并将该颜色淡化为条形图左侧和右侧的透明色。
任何帮助将不胜感激!