Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

PGFPlots "fill between" causes polar axis to disappear

Having a bit of a tough time figuring out what tikz/pgf want from me here. I've tried a few solutions from previous askers, and still can't seem to get anywhere. When I use \addplot fill between [of=A and B];, my polar axis disappears completely and no shading occurs regardless of other settings like color and opacity. Here's an example:

\begin{tikzpicture}
    \begin{polaraxis}[axis on top,
        xticklabels={,0,$\frac\pi6$,$\frac\pi3$,$\frac\pi2$,$\frac{2\pi}3$,$\frac{5\pi}6$,$\pi$,$\frac{7\pi}6$,$\frac{4\pi}3$,$\frac{3\pi}2$,$\frac{5\pi}3$,$\frac{11\pi}6$}
        ]
    \addplot+[name path = A, mark=none,domain=0:720,samples=600, black] 
        {3*sin(3 * x)};
    \addplot+[name path = B, mark=none,domain=0:720,samples=600, black] 
        {3*cos(3 * x)};]
    % \tikzfillbetween[of=A and B]{gray, opacity=0.5}
    % equivalent to (x,{sin(..)cos(..)}), i.e.
    % the expression is the RADIUS
    \addplot fill between [of=A and B];
    \end{polaraxis}
\end{tikzpicture}

disappeared axis

Another asker found a solution with \tikzfillbetween[of=A and B]{gray, opacity=0.5}, but it doesn't seem to do the job of filling the intersection of the two paths, at least in the context of a polar axis (fill between works beautifully in a rectangular axis!). It does great at filling in the union, but I'm looking for the intersection.
enter image description here

For reference, here's a fill between example from elsewhere in the same paper.
enter image description here
I totally understand if it's just not possible given the current version of pgf, but it'd be neat to know for sure. Thanks so much!

Answer*

Cancel