2

I mention my question at this link Two-set and three-set diagrams: venndiagram package in particular with 3 sets.

\documentclass[a4paper,12pt]{article}
\usepackage{venndiagram}
\begin{document}
\begin{venndiagram3sets}[labelOnlyA={4},labelOnlyB={5},labelOnlyC={7},
labelOnlyAB={3},labelOnlyAC={2},labelOnlyBC={1},labelABC={9},
labelNotABC={8}]
\setpostvennhook{\node[above right] at (venn top right){$|U|=50$};}
\end{venndiagram3sets}
\end{document}

enter image description here

The package venndiagram is old (2018-06-07). Is it possible changed the venndiagram.sty contained in the guide file, putting A, B, C outside the set and construct a diagram with 4 Venn sets that has the same characteristics as a Venn set constructed with 3 circumferences? I am not able to change venndiagram.sty and to contact Nicola L.C. Talbot author of the package here https://www.dickimaw-books.com/latexresources.html and here https://www.goodreads.com/author/show/8503877.Nicola_L_C_Talbot. In fact there is not an email to contact the author. I hope so much for your help also for my first-year students of a scientific high school.

Sebastiano
  • 54,118
  • https://www.dickimaw-books.com/contact.php but there she also states clearly that she's looking for someone taking over venndiagram. – campa Oct 19 '23 at 09:20
  • @campa Hi, if look this site https://www.dickimaw-books.com/featuretracker.php I not know the lookup ID (key). I not able to do contact the author. :-( – Sebastiano Oct 19 '23 at 09:25
  • @campa There is written that the author is searching volunteers to take over the maintenance of the following packages: probsoln venndiagram jmlr. – Sebastiano Oct 19 '23 at 09:40
  • 2
    Unfortunately, the label positions are hardcoded. I'll be honest, I'd just reimplement the whole thing. If you don't have to stroke regions individually you can get away with a bunch of clips. Furthermore, we can define the circles as nodes which makes it easy to place labels in relation to it. (For example, the label for AB can be positioned by the halfway point between nodes A and B.) Using PGFKeys we can very easily adjust a few things if needed. — Don't you need ellipses for a 4set to cover all sets? – Qrrbrbirlbel Oct 19 '23 at 11:30
  • 2
    @Sebastiano, as this package is somewhat limited it will be easier to do in Tikz. There are several questions here which focus on this alternative. – MS-SPO Oct 19 '23 at 11:37
  • @Qrrbrbirlbel Hi. I have no special needs but with the venndiagram code there is absolutely no time is wasted. The code is little and for those who are not experts in TeX they certainly understand it. I should send it to an excellent pensioned Mathematics professor who can only put the little numbers and labels on the outside. – Sebastiano Oct 19 '23 at 21:09
  • @Qrrbrbirlbel I would like to get to 4 circumferences (even disjoint - depends on the problem with the sets) by enlarging the rectangle (the universe set) that contains all the sets. For suspension dots can be added when I don't know a datum. I do not want to use TikZ for the reason that I have explained. Again infinitely thank you for your valuable help. +1 – Sebastiano Oct 19 '23 at 21:09
  • 1
    @MS-SPO Dear MS-SPO certainly with TikZ it is now easy to draw sets. But I want to use venndiagram because a very dear professor of mine should use it. The package is very simple but very limited. – Sebastiano Oct 19 '23 at 21:12
  • @Qrrbrbirlbel I have not very expert in TikZ and not know how you "I'd just reimplement the whole thing. If you don't have to stroke regions individually you can get away with a bunch of clips". – Sebastiano Oct 19 '23 at 21:15
  • The clip is only needed if you need to fill sets with colors. If not, it's as easy as @SandyG has shown. Four circles should be even easier since we can ignore the rotation. The updated version with the \VennFour macro is as simple as they come. – Qrrbrbirlbel Oct 19 '23 at 23:21
  • @QrrbrbirlbelI have understood but I would use venndiagram package for the reason that I have written. :-( – Sebastiano Oct 20 '23 at 07:50

1 Answers1

5

Updated solution

It's not much more complicated to automate this a bit. Here is a command \VennFour that takes one required argument, which is a comma separated list of regions/contents. For example,

\VennFour{a/2, bc/5, bcd/37, abc/33, abcd/3}

will place 2 in the subset that is just A, and 5 in the subset that is B and C but not A or D. Missing regions are left blank. The outer region uses the label o. The label U can be used for the universal set at the top right.

enter image description here

An optional argument can be used for TikZ options that apply to the whole picture. For example,

\VennFour[scale=.8, transform shape]{a/2, bc/5, bcd/37, abc/33, abcd/3}

would scale the entire picture.

\documentclass{article}

\usepackage{tikz} \usetikzlibrary{shapes.geometric}

\tikzset{ellip/.style={ellipse, draw, thick, minimum height=3cm, minimum width=6cm, rotate=#1 }}

\newcommand{\VennFour}[2][]{\begin{tikzpicture}[#1] \draw[thick] (-5,-4) rectangle (5,3); \coordinate(U) at (5,3.3); \node[ellip=-35, label=160:$A$] (A) at (0,0){}; \node[ellip=35, label=20:$B$] (B) at (0,0){}; \node[ellip=-30, label=270:$C$] (C) at (-1.5,-1){}; \node[ellip=30, label=270:$D$] (D) at (1.5,-1){}; \coordinate(a)at(-1.6,1.5); \coordinate(b)at(1.6,1.5); \coordinate(c)at(-3.2,0); \coordinate(d)at(3.2,0); \coordinate(ab)at(0,.8); \coordinate(cd)at(0,-2.4); \coordinate(ac)at(-2.1,.55); \coordinate(bd)at(2.1,.55); \coordinate(ad)at(1.9,-1.3); \coordinate(bc)at(-1.9,-1.3); \coordinate(abc)at(-1.1,-.2); \coordinate(abd)at(1.1,-.2); \coordinate(acd)at(.75,-1.7); \coordinate(bcd)at(-.75,-1.7); \coordinate(abcd)at(0,-1.1); \coordinate(o)at(0,-3.5); \foreach \s/\n in {#2} {\node at (\s){\n};} \end{tikzpicture}}

\begin{document}

\VennFour{U/$|U|=;?$, a/2, bc/5, bcd/37, abc/33, abcd/3, b/25, c/9, d/12, ac/0, bd/10, ab/23, abd/11, ad/1, acd/6, cd/15, o/4}

\end{document}

Original Solution

I am unfamiliar with the venndiagram package, but I don't see anything in the documentation that indicates its use for more than three sets. In particular, Venn diagrams with more than three sets can't be made from circles, and Venn diagrams with a composite number of sets can't be rotationally symmetric. [See for example, F. Ruskey, C. Savage, and S. Wagon, The search for simple symmetric Venn diagrams, Notices Amer. Math. Soc. 53 (2006) 1304–1312.]

So here is a version drawn from scratch with congruent ellipses.

enter image description here

\documentclass{article}

\usepackage{tikz} \usetikzlibrary{shapes.geometric}

\tikzset{venn/.style={ellipse, draw, thick, minimum height=3cm, minimum width=6cm, rotate=#1 }}

\begin{document}

\begin{tikzpicture} \draw[thick] (-5,-4) rectangle (5,3)node[above right]{$|U|=n$}; \node[venn=-35, label=160:$A$] (A) at (0,0){}; \node[venn=35, label=20:$B$] (B) at (0,0){}; \node[venn=-30, label=270:$C$] (C) at (-1.5,-1){}; \node[venn=30, label=270:$D$] (D) at (1.5,-1){}; \node at ([shift=(-20:.9)]A.180){1};\node at ([shift=(200:.9)]B.0){2}; \node at ([shift=(-35:1.1)]C.180){3};\node at ([shift=(215:1.1)]D.0){4}; \node at ([shift=(90:.8)]A.center){5}; \node at ([shift=(40:.8)]B.180){8};\node at ([shift=(140:.8)]A.0){7}; \node at ([shift=(-72:1.25)]A.180){6};\node at ([shift=(252:1.25)]B.0){9}; \node at (0,-2.4){10}; \node at (-1.1,-.2){11};\node at (1.1,-.2){12}; \node at (-.8,-1.7){13};\node at (.8,-1.7){14}; \node at (0,-1){15};\node at (0,-3.5){16}; \end{tikzpicture}

\end{document}

Sandy G
  • 42,558
  • 1
    I positively vote, always, all users when there is a immense effort. I would like to use venndiagram not because I didn't understand your code, but I would have to send it to a very dear and esteemed prof of mine. The venndiagram code is very simple and you don't waste your time at all. The code is stringent and for those who are not experts in TeX they definitely understand it. I hold my question in suspension in the hope that we can get to 4 circumferences (even disjoint - depends on the problem) by enlarging the rectangle that defines the universe set. Again infinitely thank you+1. – Sebastiano Oct 19 '23 at 21:00