pgf-tikz/pgfplots

[fillbetween] intersection `\pgfplotspointgetcoordinates` values get messed when `fill between` is used

Opened this issue · 0 comments

The title says it all. This was first reported at https://tex.stackexchange.com/questions/641917/using-pgfplotspointgetcoordinates-together-with-fillbetween-command.

% used PGFPlots v1.18.1
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \usepgfplotslibrary{fillbetween}
    \pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
%        % uncomment me and it (also) works ...
%        xmin=-3,
        ymin=-5,ymax=5,
        no markers,
        smooth,
    ]
        \addplot+ [name path global=fx] {+x^2 - 2};
        \addplot+ [name path global=gx] {-x^2 + 2};

        \path [name intersections={of=fx and gx, name=point}];
        \node (prusecikA) [left,  font=\scriptsize]
            at (point-1) {%
            \pgfplotspointgetcoordinates{(point-1)}
            $A =(
                \pgfmathprintnumber[fixed]{\pgfkeysvalueof{/data point/x}},
                \pgfmathprintnumber[fixed]{\pgfkeysvalueof{/data point/y}}
            )$
        };

        % comment me to show the right intersection coordinates (-\sqrt{2}, 0)
        \addplot fill between [of=gx and fx, soft clip={domain=-1:1}];
    \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code