5

see this image, how can tike fading path the same? enter image description here

To give more details:

  1. If we just feed color top/middle/bottom just like below code:

    \addplot[fill opacity=1,top color=white,bottom color=white,middle color=black] fill between [of=A and B];

The result picture is:

enter image description here

  1. If we just feed color left/middle/right just like below code:

    \addplot[fill opacity=1,left color=white,right color=white,middle color=black] fill between [of=A and B];

The result picture is:

enter image description here

This case more like the reference duplicate one.

But the original picture is fading like following the curve's direction and color fading from center to border. so it's very special.

Schrödinger's cat's answer just do a work around to draw multiple times fading and shrink it one by one, then it just simulate that effect. it's slow for sure since divided the drawing into a loop. but that's what we want exactly.

2
  • Does this answer your question? Stroke with variable thickness
    – user108724
    Apr 1, 2020 at 18:21
  • @C.F.G Sounds like a little different, that question is fading following the path, this question is around the path.
    – lucky1928
    Apr 1, 2020 at 18:24

1 Answer 1

6

If the question is whether it is possible to fabricate a plot that looks similar to the one you show, the answer is affirmative.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[declare function={f(\x,\y)=tanh((1840+\y-\x)/200)*\x/1.8;},
        scaled y ticks=false,
        xmin=0,xmax=1800,ymin=0,ymax=1100,
        yticklabel={\pgfmathparse{\tick/1000}\pgfmathprintnumber\pgfmathresult}
    ]
    \addplot[domain=0:2000,samples=201] 
    {f(x,0)};
    \pgfplotsinvokeforeach{1,...,20}{
    \addplot[domain=0:2000,samples=201,name path=A,draw=none] 
    {(1+#1/400)*f(x,5*#1)};
    \addplot[domain=0:2000,samples=201,name path=B,draw=none] 
    {(1-#1/400)*f(x,-5*#1)};
    \addplot [black,fill opacity=0.1] fill between [of=A and B];
    }
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

If the function here was invertible, there would be a much simpler way using a surface plot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .