Setup: using Tikz in beamer.
I want to fill with color a region delimited by some line segments and a circle. Since I did not manage to use \clip together with paths, I looked around and found this alternative solution using PGf Plots \fillbetween.
On the right part of the MWE (see figure below), everything works exactly as I want it. On the left part however, there is a white triangular region inside the circle that I would like to be filled with gray instead. I tried playing around to try to understand how the layers work with the clipping, but I just got more confused.
May be related:
- This question appears to be really related, but I'm not sure if my path is beginning in another place. It feels more like it is somehow translated. But even if it was the same problem, I don't know how to apply the solutions there to my case.
\documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usepgfplotslibrary{fillbetween}\begin{document}
\begin{tikzpicture} \pgfdeclarelayer{pre main} \pgfsetlayers{pre main,main} \coordinate (1) at (-4.7,4.5); \coordinate (2) at (-3.2,4.1); \coordinate (a) at (-4.9,2.3); %\coordinate (a) at (-4,2.3); %%%%change (a) causes even stranger behaviour \coordinate (c) at (-6.9,8.7); \coordinate (e) at (-2.7,8.8); \coordinate (f) at (-4.5,2.3); \coordinate (g) at (2.9,6.2);\clip (-7,2) rectangle (-1.5,5); %edges \draw [name path=D] (a)-- (c); \draw [name path=E] (f)-- (e); \draw [name path=A] (f)-- (g); %dots \draw [fill=black] (1) circle (2.5pt); \draw [fill=black] (2) circle (2.5pt); %circles \pgfonlayer{pre main} \begin{scope} \clip[insert path={(1) circle (1cm)}]; %%%%remove the clip gives impression that the path is translated \tikzfillbetween[of=E and D]{gray}; \end{scope} \begin{scope} \clip[insert path={(2) circle (1cm)}]; \tikzfillbetween[of=A and E]{gray}; \end{scope} \endpgfonlayer \end{tikzpicture}\end{document}
Thanks in advance!

