4

EDIT:: I saw the question mentioned in here which the moderator considered mine duplicate. However, I couldn't see how mine is duplicate. My main problem is to write the text in the intersection of CAT B and CAT C.

I am trying to create the following Venn diagram. enter image description here

Following is my code and output:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
\begin{scope}[blend group = soft light]
\fill[red!30!white]   ( 90:1.2) circle (2);
\fill[green!30!white] (210:1.2) circle (2);
\fill[blue!30!white]  (330:1.2) circle (2);
\end{scope}
\node at ( 90:2)    {CAT A};
\node at ( 210:2)   {CAT B};
\node at ( 330:2)   {CAT C};
\node [font=\small] {text1, text2, text3, text4};
\end{tikzpicture}
\end{document}

enter image description here

5
  • For line breaks in nodes, see tex.stackexchange.com/questions/123671/… Commented Mar 19, 2018 at 10:32
  • you might try the venndiagram package: ctan.org/pkg/venndiagram?lang=en
    – Ross
    Commented Mar 19, 2018 at 12:14
  • If you want to have the texts stacked, just use \node [font=\small,text width=1cm] {text1, text2, text3, text4}; instead of \node [font=\small] {text1, text2, text3, text4};.
    – user121799
    Commented Mar 19, 2018 at 15:04
  • How this question is duplicate??? I vote for reopenning it. Commented Mar 19, 2018 at 22:57
  • No one of the answers showed how to write in the intersections. Commented Mar 19, 2018 at 22:59

3 Answers 3

3

I provide two examples. The first has a different layout compared to what you posted because I recycled something I had done previously. The second example uses the venndiagram package.

This is the code:

\documentclass[tikz,border=2pt,multi]{standalone}
\usepackage{venndiagram}

\tikzset{venn circle/.style={draw=gray,text opacity=1,fill opacity=0.25,circle,minimum width=10cm,fill=#1,line width=2pt}}
\tikzset{label/.style={text width=1.5cm,font=\large\sffamily}}

\begin{document}

\begin{tikzpicture}
    \begin{scope}[blend mode=screen]
          \node [venn circle = yellow] (A) at (0,0) {};
          \node [label] (A1) at (-2.5,0) {Cat A};
%
          \node [venn circle = green] (B) at (5,0) {};
          \node [label] (B1) at (7.5,0) {Cat B};  
%             
          \node [venn circle = orange] (C) at (2.5,5) {};
          \node [label] (C1) at (2.5,6.25) {Cat C};
% Use a tabular to stack the text
          \node [label] (D) at (5,3.75){\begin{tabular}{l} text1,\\text2,\\text3,\\text4 \end{tabular}};
        \end{scope}
\end{tikzpicture}

\begin{venndiagram3sets}[radius=5cm,overlap=3cm,
                         tikzoptions={text opacity=1,fill opacity=0.25},
                         labelOnlyBC={\begin{tabular}{l} text1,\\text2,\\text3,\\text4 \end{tabular}}]
   \fillBCapCNotA 
\end{venndiagram3sets}

\end{document}

This is the result: enter image description here enter image description here

1

You can use either

\node [font=\small, align=center] {text1, \\ text2, \\ text3, \\ text4};

as you need the align for several lines or

\node [font=\small, text width=1cm] {text1, text2, text3, text4};

Depending if you want it to happen automatically or manually.

enter image description here

2
  • I want the text in the intersection between A and C Commented Mar 19, 2018 at 23:00
  • give a position at the node: \node [font=\small,align=center] at (30:2.2) {text1, text2,\\ text3, text4}; and change the circle to \fill[red!30!white] ( 90:1.8) circle (3);
    – Shade
    Commented Mar 20, 2018 at 8:59
0

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}
\begin{document}
\begin{tikzpicture}
  \begin{scope}[blend group = soft light]
    \fill[green!30!white] ( 90:1.2) circle (2);
    \fill[blue!30!white] (210:1.2) circle (2);
  \end{scope}
  \node at ( 90:2)    {A};
  \node at ( 210:2)   {B};
  \node [font=\Large] {AUB};
  \draw (0,0) rectangle (4,4) node [text=black,above] {U};
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .