# Pgfplots: fillbetween, enlargelimits and soft clip have interesting interactions

Setup: TexLive 2018

Consider the MWE below, provided by one of my users. He complained that the pattern disappears as soon as soft clip was used. Creating the MWE we noticed the following

• If enlargelimits is removed, the pattern is shown
• If enlargelimits is enabled, but soft clip is disabled, the pattern is shown

Can anyone explain what is going on here?

I don't think the enlargelimits is relevant for the real use case, but we'd like to know why this happens

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{patterns}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.16}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
width = 13cm,
axis lines = center,
grid = minor,
xmin = -0,
xmax = 1.05,
ymin = -0.25,
ymax = 0.45,
%   enlargelimits = {abs=0.04}, % if this is enabled the pattern disappears
domain = 0:1,
xtick distance = 0.1,
ytick distance = 0.1,
xticklabels = {,,},
yticklabels = {,,},
]
\addplot [smooth, samples=100, color=black, thick] {x*(1-x)};
\addplot [name path=B, smooth, samples=100, color=black, thick, dotted] {x*(1-x)+0.06};
\addplot [name path=A, smooth, samples=100, color=black, thick, dotted] {x*(1-x)-0.06};
pattern=north west lines, pattern color=black!50
]
fill between[of=A and B,
soft clip={domain=0:1} % if this is enabled and enlargelimits is
%enabled pattern disappears
];
\end{axis}
\end{tikzpicture}
\end{document}

• After a quick look I first thought that you have found another instance of the already reported bug #194. But now I think that is because of numerical inaccuracies. There is no need to use soft clip when the plots to that you apply the soft clip have the same domain. So either removing all smoothes, enlarging the (normal) domain or decreasing the domain used in soft clip makes the example work as expected. Do you agree? Sep 7 '18 at 12:56
• @StefanPinnow well, even if the soft clip domain is the same as the draw domain is the same, that should surely not remove the pattern. What is the reasoning behind that? And why is it enlargelimits that triggers it? Works just fine without it on the full domain Sep 7 '18 at 13:26

This is a defect in the computation of soft clip: apparently the fact that soft clip and the plot domain are the same runs into some computational problem.
• Thanks. Any idea why enlargelimits may have an effect on the combination? Sep 13 '18 at 7:24