2

How do I decrease the thickness of the line encompassing A intersection B? This is my Code:

\documeentclass{book}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{venndiagram2sets}[tikzoptions={scale=1.7, line width = 0.2cm}, labelA= {}, labelB={}, showframe=false, shade={}]
\setpostvennhook{
\draw (labelA) node[above=0.2cm, left=1.1cm]{\LARGE $A$};
\draw (labelB) node[above=0.2cm, right=1.1cm]{\LARGE $B$};}
\begin{scope}[pattern= horizontal lines]
\fillACapB
\end{scope}
\begin{scope}[pattern= north east lines]
\fillACapB
\end{scope}
\end{venndiagram2sets}
\end{document}

I want it to be something like this: enter image description here

Bernard
  • 271,350
  • Maybe have a look at: https://tex.stackexchange.com/questions/9681/how-to-draw-venn-diagrams-especially-complements-in-latex it might help. – Paul A Jun 18 '22 at 12:37
  • Or https://latexdraw.com/how-to-draw-venn-diagrams-in-latex/ – Paul A Jun 18 '22 at 12:44
  • Worst case you have to draw the diagram manually. Should not be very hard, figure out some way to draw circle section, fill a region, draw an arc etc. – user202729 Jun 18 '22 at 13:01

2 Answers2

5
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\draw[line width=8pt] (0,0) circle[radius=2cm] (3,0) circle[radius=2cm];
\filldraw[fill=white] (0,0) circle[radius=2cm] (3,0) circle[radius=2cm];
\clip (0,0) circle[radius=2cm];
\fill[pattern=crosshatch] (3,0) circle[radius=2cm];
\end{tikzpicture}
\end{document}

Two circles and area between them

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\draw[line width=8pt] (0,0) circle[radius=2cm] (3,0) circle[radius=2cm] (60:3) circle[radius=2cm];
\filldraw[fill=white] (0,0) circle[radius=2cm] (3,0) circle[radius=2cm] (60:3) circle[radius=2cm];
\clip (0,0) circle[radius=2cm];
\clip (60:3) circle[radius=2cm];
\fill[pattern=crosshatch] (3,0) circle[radius=2cm];
\end{tikzpicture}
\end{document}

Three circles and their intersections

2

Just to play a bit (if you want to do more complex diagrams, you'll have to calculate the angles more accurately).

A cap B thinner

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{intersections}

\begin{document} \begin{tikzpicture} \path[name path=circleA] (0,0) circle [radius=3]; \path[name path=circleB] (4,0) circle [radius=3]; \path[name intersections={of=circleA and circleB}] ; \draw[red,fill=orange] (intersection-1) arc(132:228:3) arc(-48:48:3); \draw[red,line width=3pt] (intersection-1) arc(48:312:3) arc(-132:132:3) -- cycle; \end{tikzpicture} \end{document}

EDIT

A second approach (which I don't really like because of the white fill which doesn't allow to have something under the picture, but anyway it's quite unlikely) is the following where the lines seem better to my eyes.

V2

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{intersections}

\begin{document} \begin{tikzpicture} \path[name path=circleA] (0,0) circle [radius=3]; \path[name path=circleB] (4,0) circle [radius=3]; \path[name intersections={of=circleA and circleB}] ;

    \draw[red,line width=15pt] (intersection-1) arc(48:312:3) arc(-132:132:3) -- cycle; 
    \fill[white] (intersection-1) arc(48:312:3) arc(-132:132:3) -- cycle; 
    \draw[red,fill=orange] (intersection-1) arc(132:228:3) arc(-48:48:3);
\end{tikzpicture}

\end{document}

SebGlav
  • 19,186