Menu

#85 addplot with fillbetween breaks `at=` placement

v1.0 (example)
closed
nobody
None
5
2015-11-28
2015-05-15
Ignasi
No

As expected, following code, places south west anchor at (5,2), but as soon as commented line is uncommented, the whole plot moves at (0,0).

\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}

\begin{document}
\begin{tikzpicture}
\draw (0,0) grid (12,8);
\begin{axis}[at={(5cm,2cm)}]
\addplot[name path=A, domain=1:3] {2-abs(x-2)};
\draw[name path=B, thick, black] (axis cs:1,1) -- (axis cs:3,1);
% \addplot[thick, fill=red] fill between[of=A and B] ; %line C
\end{axis}
\end{tikzpicture}
\end{document}

Discussion

  • Christian Feuersänger

    Thanks for the report.

    This sounds a lot like a duplicate of what I refer to as "cell picture bug": fill between activates layered graphics under the hood, and layered graphics activate "cell picture=false". This, in turn, results in spacing/bounding box issues, especially in conjunction with shifts.

    The bug is open for some time, and I failed to get a grip on it so far.

    I'll take care of it.

    A workaround could be to disable layered graphics (for example by adding 'on layer={}' to the option list of fill between. This might look ugly, though. :-/

     
  • Stefan Pinnow

    Stefan Pinnow - 2015-11-22

    related to bug #76, right?
    still open with 2015-11-22 Revision 1.12.1-92-ge3c6f9d

     
  • Christian Feuersänger

    • status: open --> closed
     
  • Christian Feuersänger

    Yes, this is a duplicate of bug #76. Closing this one