pgfplots 在两个轴之间的填充不起作用

pgfplots 在两个轴之间的填充不起作用

考虑以下 MWE:

\documentclass[10pt, border=0pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}

\pgfplotsset{
compat=1.13, 
width=100pt,
height=100pt,
scale only axis,
}

\begin{document}
\begin{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \begin{axis}[
      axis x line=middle,
      axis y line=middle,
      name = plot1,
      yticklabels = {,},
      xticklabels = {,},
      domain=-1:1,
      ]%

    \addplot[black, name path = path1] {-x*abs(x)};

    \path[name path=lower_edge1] (axis cs:-1,-1) -- (axis cs:1,-1);
    \path[name path=upper_edge1] (axis cs:-1,1) -- (axis cs:1,1);

    \addplot [fill=blue, fill opacity=0.05] fill between [of=path1 and lower_edge1];
    \addplot [fill=red, fill opacity=0.05] fill between [of=path1 and upper_edge1];

    \end{axis}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{axis}[
      axis x line=middle,
      axis y line=middle,
      at=(plot1.east), anchor=west,
      yticklabels = {,},
      xticklabels = {,},
      domain=-1:1,
    ]%

    \addplot[black, name path = path2] {-x*abs(x)};

    \path[name path=lower_edge2] (axis cs:-1,-1) -- (axis cs:1,-1);
    \path[name path=upper_edge2] (axis cs:-1,1) -- (axis cs:1,1);

    \addplot [fill=blue, fill opacity=0.05] fill between [of=path2 and lower_edge2];
    \addplot [fill=red, fill opacity=0.05] fill between [of=path2 and upper_edge2];

\end{axis}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tikzpicture}%
\end{document}

对我来说,它产生以下输出:

输出

为什么第二轴fillbetween不起作用?

相关内容