I am trying to draw a graph that can be represented as boolean operations on three shapes: A, B, C. The graph is A - B - C
(or A - (B U C)
). However, I have no Idea how to draw it using \clip
or other commands in Tikz.
For example, here is some code adapted from TikZ example, and the first picture below is what the code generates, but the second is what I want.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}
\begin{document}
\pagestyle{empty}
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(45:2cm) circle (1.5cm)}
\def\thirdcircle{(0:2cm) circle (1.5cm)}
\begin{tikzpicture}
\draw \firstcircle node[below] {$A$};
\draw \secondcircle node [above] {$B$};
\draw \thirdcircle node [below] {$C$};
\begin{scope}
\clip \firstcircle;
\fill[red] \secondcircle;
\end{scope}
\begin{scope}
\clip \firstcircle;
\clip \secondcircle;
\fill[green] \thirdcircle;
\end{scope}
\end{tikzpicture}
\end{document}
Edit: To be specific, I am not trying to draw a Venn diagram, but to draw some shape from three basic shapes, but the implementation need to:
- Allow any kind of shapes (not only circles)
- Transparent (cannot use the white color)
- Image border does not include B and C
See this new image as an example
venn-diagram
tag, it feels a bit misleading to mevenn-diagram
tag. Do you know any other tags I should put?