0

In the below graph, the fill below function works great for filling in between, path B and path C. But it is not so good when I do not want to fill anything below path A (that is I do not want the area under blue line shaded, I do not how to get rid of that shaded area). Is there a way to do this?

\usepackage{tikz}
\usepackage{pgfplots}

\begin{tikzpicture}
\begin{axis}[
  axis lines = left,
  xlabel = $x$,
  ylabel = $ $,
  ymin = 0,
  ymax = 6,
  xmin = 0,
  xmax = 4,
  samples = 100,
  xticklabels={},
  yticklabels={},
]
\addplot[color=blue, domain=0:4,name path =A] {4-x};
\addplot[color=red, domain=0:4, name path =C] {x};
\addplot[color=purple, domain=0:4, name path =B] {1.5*x};
\addlegendentry{$f(x)= a-bx$}
\addlegendentry{$g(x)= \tilde{d}x$}
\addlegendentry{$g(x)= dx$}
 \addplot fill between[ 
    of = C and B, 
    soft clip={domain=1.6:2},
  ];
 \addplot fill between[ 
    of = C and A, 
    soft clip={domain=1.6:2},
  ];


\end{axis}
\end{tikzpicture}

0 Answers0