Using the solution present in Groupplot to generate group plots and Fill Between-under curve to shade area under the curve generated by a scatter plot, I am having issues with the output. It is always filling the chart area with white. Here is a sample code
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.10}
\usetikzlibrary{pgfplots.groupplots}
%\pgfplotsset{plot coordinates/math parser=false}
\makeatletter
\pgfplotsset{
groupplot xlabel/.initial={},
every groupplot x label/.style={
at={($({group c1r\pgfplots@group@rows.west}|-{group c1r\pgfplots@group@rows.outer south})!0.5!({group c\pgfplots@group@columns r\pgfplots@group@rows.east}|-{group c\pgfplots@group@columns r\pgfplots@group@rows.outer south})$)},
anchor=north,
},
groupplot ylabel/.initial={},
every groupplot y label/.style={
rotate=0,
at={($({group c1r1.north}-|{group c1r1.outer
west})!0.5!({group c1r\pgfplots@group@rows.south}-|{group c1r\pgfplots@group@rows.outer west})$)},
anchor=east
},
execute at end groupplot/.code={%
\node [/pgfplots/every groupplot x label]
{\pgfkeysvalueof{/pgfplots/groupplot xlabel}};
\node [/pgfplots/every groupplot y label]
{\pgfkeysvalueof{/pgfplots/groupplot ylabel}};
},
group/only outer labels/.style =
{
group/every plot/.code = {%
\ifnum\pgfplots@group@current@row=\pgfplots@group@rows\else%
\pgfkeys{xticklabels = {}, xlabel = {}}\fi%
\ifnum\pgfplots@group@current@column=1\else%
\pgfkeys{yticklabels = {}, ylabel = {}}\fi%
}
}
}
\def\endpgfplots@environment@groupplot{%
\endpgfplots@environment@opt%
\pgfkeys{/pgfplots/execute at end groupplot}%
\endgroup%
}
\makeatother
\begin{filecontents}{data.dat}
sat1 etc1 sat2 etc2 sat3 etc3 sat4 etc4
0 0.06 0 0.10 0 0.17 0 0.25
10 0.09 10 0.15 10 0.23 10 0.31
20 0.13 20 0.22 20 0.30 20 0.37
30 0.15 30 0.27 30 0.36 30 0.43
40 0.17 40 0.31 40 0.42 40 0.49
50 0.19 50 0.31 50 0.46 50 0.53
60 0.20 60 0.32 60 0.47 60 0.54
70 0.22 70 0.33 70 0.48 70 0.55
80 0.24 80 0.34 80 0.49 80 0.56
90 0.25 90 0.35 90 0.50 90 0.57
100 0.27 100 0.35 100 0.51 100 0.58
\end{filecontents}
\begin{document}
\pgfplotstableread{data.dat}{\1}
\begin{tikzpicture}
\pgfplotsset{%
label style={font=\scriptsize},
tick label style={font=\scriptsize},
axis line style={<->},
width=4cm,
height=4cm,
scale only axis
}
\begin{groupplot}[%
group style={group size=2 by 1,
horizontal sep=5pt,
vertical sep=5pt},
xtick={0,10,20,30,40,50,60,70,80,90},
xticklabels={0,10,20,30,40,50,60,70,80,90},
yticklabels={0,0.1,0.2,0.3,0.4,0.5,0.6},
ytick={0,0.1,0.2,0.3,0.4,0.5,0.6},
groupplot ylabel={Y label},
groupplot xlabel={X label},
group/only outer labels
% legend style={legend cell align=right,legend plot pos=right}
]
% ROW 1
\nextgroupplot[
xmin=0,
xmax=100,
ymin=0,
ymax=0.6,
title=\textbf{$\phi=25\%$},every axis title/.style={below right,at={(0,1)},draw=black,fill=white}
]
\addplot+ [smooth,blue,name path=A] table[x={sat4}, y={etc4}] {\1};
\addplot+[draw=none,name path=B, domain=1:50, mark=none] {1};
\addplot+[gray, fill opacity=0.4] fill between[of=A and B,soft clip={domain=1:50}];
\nextgroupplot[
% ylabel={E=10 GPa},
xmin=0,
xmax=100,
ymin=0,
ymax=0.6,
title=\textbf{$\phi=30\%$},every axis title/.style={below right,at={(0,1)},draw=black,fill=white}
]
\addplot+ [smooth,blue,name path=A] table[x={sat3}, y={etc3}] {\1};
\addplot+[draw=none,name path=B, domain=1:50, mark=none] {1};
\addplot+[gray, fill opacity=0.4] fill between[of=A and B,soft clip={domain=1:50}];
\makeatletter
\end{groupplot}
\end{tikzpicture}
\end{document}
I think there seems to be a layering issue which I can't figure out. Alternate suggestions which don't use Fill Between are also welcome.
