I somehow have problems getting the area below my curve filled. The library fillbetween
should be able to handle this but fails for me (probably because of me).
MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\usepgfplotslibrary{fillbetween}
\begin{document}
\pgfplotstableread[row sep=\\,col sep=&]{
amount & data \\
1 & 90022 \\
2 & 105302 \\
3 & 117969 \\
4 & 133371 \\
5 & 147297 \\
6 & 161596 \\
7 & 175571 \\
8 & 222404 \\
9 & 232617 \\
10 & 245301 \\
}\datapoints
\begin{tikzpicture}
\begin{axis}[
ymin=-20000, ymax=300000,
]
\addplot[green!60!black, line width=1.2pt, name path=base, smooth] table[x=amount, y=data]{\datapoints};
\path[name path=xaxis] (axis cs:1,0) -- (axis cs:10,0);
\addplot [
thick,
color=blue,
fill=green!60!black,
fill opacity=0.5
]
fill between[
of=xaxis and base,
soft clip={domain=1:10},
];
\end{axis}
\end{tikzpicture}
\end{document}
The result for me looks like this:
Obviously I want the complete area below the curve filled.
As soon as I remove the attribute smooth
from addplot
everything works as expected. If I use soft clip={domain=2:10}
as option for fill between it works as well (but just fills between 2 and 10).
I am unable to see how I can fill the whole area and still use a smooth curve. Any help would be greatly appreciated.
soft clip={domain=1.01:10},
and it'll work.