我正在尝试生成一个 ybar 图,其中每个条形从淡入淡出再变回透明。我希望每个条形在开始时都是完全透明的颜色,在结束时再次完全透明。现在看来,淡入淡出只需设置一次即可应用于所有条形。
我如何为每个条形单独设置淡入淡出效果?有什么想法吗?
谢谢你!
\documentclass [tikz] {standalone}
\usepackage{pgfplots}
\usetikzlibrary{fadings}
\begin{document}
\begin{tikzpicture}[ >=stealth]
\begin{axis}[xbar stacked,
axis lines*=left,
width=15cm, height=6cm,
xtick = {1,10},
xmin=1, xmax=10,
xmode=log,
xmajorgrids=true, xminorgrids=true, minor tick num=1,
ymajorgrids=false, yminorgrids=false,
bar width=15pt,
symbolic y coords={One,Two,Three,Four},
]
\addplot[draw = none] coordinates % Invisible 1. bar
{(1,One) (2,Two) (2,Three) (2,Four)};
\addplot[draw = none, fill=blue!30!black, path fading=west] coordinates
{(1,One) (2,Two) (2,Three) (2,Four)};
\addplot[draw = none, fill=blue!30!black] coordinates
{(1,One) (2,Two) (2,Three) (2,Four)};
\addplot[draw = none, fill=blue!30!black, path fading=east] coordinates
{(1,One) (2,Two) (2,Three) (2,Four)};
\end{axis}
\end{tikzpicture}
\end{document}