Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need to draw Venn diagrams for some special sets. In these sets I knew for example that the intersection of some of them are empty, so I wanted to draw a special venn diagram that omits those empty intersections.

I made a graph that each vertex is a set or a intersection of sets. Them I deleted vertex with empty intersection. This way I can get the coordinates of each vertex.

Using mindmap I could make a modified venn diagram. But them don't seem quite good enough. The connection between them are small (there is a decoration called "circle connection bar" but I don't know how can I modify the node concept using this). A simple example bellow of a posibility.

I just wanted some tips on what kind of parameters should I change to make it better looking. Or maybe a complete change around, maybe midmap isn't the best way.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap}

\begin{document}

\begin{tikzpicture}[small mindmap,scale=4,opacity=0.4]
\coordinate (A)   at (2.00003,0.882642);
\coordinate (AB)  at (1.49021,1.74189);
\coordinate (AC)  at (1.50998,0.0102365);
\coordinate (ABC) at (1.00055,0.8711);
\coordinate (B)   at (0.490009,1.73215);
\coordinate (BC)  at (0.,0.860431);
\coordinate (C)   at (0.510476,0.);
% The links between the sets.
% In this notation AB means the intersection of A with B.
\path [concept color=red]
    node [concept] at (A) {}
        child  {node [concept] at (AB) {}}
        child  {node [concept] at (AC) {}}
        child  {node [concept] at (ABC) {}};
\path [concept color=blue]
    node [concept] at (B) {}
        child  {node [concept] at (AB) {}}
        child  {node [concept] at (BC) {}}
        child  {node [concept] at (ABC) {}};
\path [concept color=green]
    node [concept] at (C) {}
        child  {node [concept] at (AC) {}}
        child  {node [concept] at (BC) {}}
        child  {node [concept] at (ABC) {}};
% Place the label later, otherwith they got transparent
\path [opacity=1]
    node at (A) {$A$}
    node at (B) {$B$}
    node at (C) {$C$}
    node at (AB) {$A \cap B$}
    node at (AC) {$A \cap C$}
    node at (BC) {$B \cap C$}
    node at (ABC) {$A \cap B \cap C$};
\end{tikzpicture}

\end{document}

share|improve this question
add comment

1 Answer

How about this: I used hexagonal nodes instead of circles. You just need to set the colors and separation, the connections are automatically computed to be the average color of the nodes they connect. A node can be assigned one of two styles, venn and unvenn. While venn draws the node, unvenn makes it transparent. You don't need to remove the =some color when using unvenn, this parameter is simply not used in the definition of unvenn.

The Code

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes}

\pgfdeclarelayer{background layer}
\pgfsetlayers{background layer,main}

\begin{document}

\colorlet{abccolor}{gray!50}
\colorlet{acolor}{red!50!gray}
\colorlet{abco\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes}

\pgfdeclarelayer{background layer}
\pgfsetlayers{background layer,main}

\begin{document}

\colorlet{abccolor}{gray!50}
\colorlet{acolor}{red!50!gray}
\colorlet{abcolor}{orange!50!gray}
\colorlet{bcolor}{yellow!50!gray}
\colorlet{bccolor}{green!50!gray}
\colorlet{ccolor}{blue!50!gray}
\colorlet{accolor}{violet!50!gray}

\pgfmathsetmacro{\nodescenterseparation}{4}

\begin{tikzpicture}
[   venn/.style={regular polygon, regular polygon sides=6,shape border rotate=30, minimum width=3cm,draw,inner sep=0,fill=#1,draw=#1!70!black,very thick},
    unvenn/.style={regular polygon, regular polygon sides=6,shape border rotate=30, minimum width=3.5cm,opacity=0},
]
    \node[venn=abccolor] at (0,0) (abc) {$A\cap B\cap C$};
    \node[venn=acolor] at (0:\nodescenterseparation) (a) {$A$};
    \node[venn=abcolor] at (60:\nodescenterseparation) (ab) {$A\cap B$};
    \node[venn=bcolor] at (120:\nodescenterseparation) (b) {$B$};
    \node[venn=bccolor] at (180:\nodescenterseparation) (bc) {$B\cap C$};
    \node[venn=ccolor] at (240:\nodescenterseparation) (c) {$C$};
    \node[venn=accolor] at (300:\nodescenterseparation) (ac) {$A\cap C$};

    \begin{pgfonlayer}{background layer}
        \fill[abccolor!50!acolor] (abc.corner 6) -- (abc.center) -- (abc.corner 5) -- (a.corner 3) -- (a.center) -- (a.corner 2) -- cycle;
        \fill[abccolor!50!abcolor] (abc.corner 1) -- (abc.center) -- (abc.corner 6) -- (ab.corner 4) -- (ab.center) -- (ab.corner 3) -- cycle;
        \fill[abccolor!50!bcolor] (abc.corner 2) -- (abc.center) -- (abc.corner 1) -- (b.corner 5) -- (b.center) -- (b.corner 4) -- cycle;
        \fill[abccolor!50!bccolor] (abc.corner 3) -- (abc.center) -- (abc.corner 2) -- (bc.corner 6) -- (bc.center) -- (bc.corner 5) -- cycle;
        \fill[abccolor!50!ccolor] (abc.corner 4) -- (abc.center) -- (abc.corner 3) -- (c.corner 1) -- (c.center) -- (c.corner 6) -- cycle;
        \fill[abccolor!50!accolor] (abc.corner 5) -- (abc.center) -- (abc.corner 4) -- (ac.corner 2) -- (ac.center) -- (ac.corner 1) -- cycle;

        \fill[acolor!50!abcolor] (a.corner 2) -- (a.center) -- (a.corner 1) -- (ab.corner 5) -- (ab.center) -- (ab.corner 4) -- cycle;
        \fill[abcolor!50!bcolor] (ab.corner 3) -- (ab.center) -- (ab.corner 2) -- (b.corner 6) -- (b.center) -- (b.corner 5) -- cycle;
        \fill[bcolor!50!bccolor] (b.corner 4) -- (b.center) -- (b.corner 3) -- (bc.corner 1) -- (bc.center) -- (bc.corner 6) -- cycle;
        \fill[bccolor!50!ccolor] (bc.corner 5) -- (bc.center) -- (bc.corner 4) -- (c.corner 2) -- (c.center) -- (c.corner 1) -- cycle;
        \fill[ccolor!50!accolor] (c.corner 6) -- (c.center) -- (c.corner 5) -- (ac.corner 3) -- (ac.center) -- (ac.corner 2) -- cycle;
        \fill[accolor!50!acolor] (ac.corner 1) -- (ac.center) -- (ac.corner 6) -- (a.corner 4) -- (a.center) -- (a.corner 3) -- cycle;
    \end{pgfonlayer}
\end{tikzpicture}

\end{document}

Result with all sets non-empty

enter image description here

Result with ABC, A and BC empty

\node[unvenn=abccolor] at (0,0) (abc) {$A\cap B\cap C$};
\node[unvenn=acolor] at (0:\nodescenterseparation) (a) {$A$};
\node[venn=abcolor] at (60:\nodescenterseparation) (ab) {$A\cap B$};
\node[venn=bcolor] at (120:\nodescenterseparation) (b) {$B$};
\node[venn=bccolor] at (180:\nodescenterseparation) (bc) {$B\cap C$};
\node[unvenn=ccolor] at (240:\nodescenterseparation) (c) {$C$};
\node[venn=accolor] at (300:\nodescenterseparation) (ac) {$A\cap C$};

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.