6

I have a problem with fill between option when I try to use it for more than one plot. Here is the code:

    \documentclass{standalone}

    \usepackage{pgfplots}

    \pgfplotsset{compat=1.10}

    \usepgfplotslibrary{fillbetween}

    \begin{document}


    \begin{tikzpicture} 
        \begin{axis}[enlargelimits=0.1]
        \addplot[name path=f,domain=-.15:1.05,blue, draw=none] {x^2};
        %\addplot[name path=g, domain=.15:1.05,blue, draw=none] {x^3}; 
        \path[name path=g] (axis cs:0,0) -- (axis cs:1,0);

        \addplot [
            fill=orange, 
            opacity=0.5
        ]
        fill between[
            of=f and g,
            soft clip={domain=0:1},
        ];

        \end{axis}
    \end{tikzpicture} 

    \begin{tikzpicture} 
        \begin{axis}[enlargelimits=0.1]
        \addplot[name path=f,domain=-.15:1.05,blue, draw=none] {x^2};
        \addplot[name path=g, domain=.15:1.05,blue, draw=none] {x^3}; 
        %\path[name path=g] (axis cs:0,0) -- (axis cs:1,0);

        \addplot [
            fill=orange, 
            opacity=0.5
        ]
        fill between[
            of=f and g,
            soft clip={domain=0:1},
        ];

        \end{axis}
    \end{tikzpicture} 

    \end{document}

and here is the output

enter image description here

As you can see, it works fine for the first picture but it fails to work for the second one. If I remove the first picture, then the second one works fine as well.

enter image description here

4
  • 1
    Does this persist if you change the names of the paths in the second plot? Also please try to make your examples independent from your data files.
    – percusse
    Mar 23, 2015 at 13:38
  • It works when I change the names of the paths. Thank you a lot!
    – Telemach
    Mar 23, 2015 at 13:41
  • @ChristianFeuersänger Does this need an additional bug report or you take it from here?
    – percusse
    Mar 23, 2015 at 13:42
  • I edited the question so that the plots are independent of the data files.
    – Telemach
    Apr 5, 2015 at 10:41

1 Answer 1

5

This is a software defect. A software upgrade of pgfplots to version 1.11 or 1.12 will fix it (tested together with PGF 3.0.0).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .