1

I want to draw hypergraph on LaTex, here what I do :

 \documentclass{article}
 \usepackage{tikz}

 \begin{document}
 \begin{tikzpicture}

 \tikzset{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.6}}

\node [venn circle = white] (A) at (0,0) {$1$};
\node [venn circle = white] (B) at (60:4cm) {$2$};
\node [venn circle = white] (C) at (0:4cm) {$3$};
\node[left] at (barycentric cs:A=1/2,B=1/2 ) {$1$}; 
\node[below] at (barycentric cs:A=1/2,C=1/2 ) {$3$};   
\node[right] at (barycentric cs:B=1/2,C=1/2 ) {$2$};   
\node[below] at (barycentric cs:A=1/3,B=1/3,C=1/3 ){$1,2,3,4$};

\end{tikzpicture}  

\end{document}

Then it will produce

enter image description here

I try to learn this LaTex code to create what I want, but i don't understand it. I hope anyone can help me. thank you

  • What would you like to change? You want the lavels $e_i$ outside. You also want the "dot before the numbers? And also, when you write 1...1 what do you exactly mean with that? – Alex Recuenco Dec 11 '17 at 7:24
  • 1
    Do you just want the "shape" of the sets to be slightly irregular rather than be perfect circles as in the OP? – Andrew Dec 11 '17 at 8:23
2

You can find various example of how to draw irregular shapes here: How to draw a irregular circle(shape)?

My MWE is based on Guilherme Zanotelli's answer.

\documentclass{article} 
\usepackage{tikz} 
\usetikzlibrary{decorations.pathmorphing, positioning}
\tikzset{
    mydot/.style={
        circle, inner sep =1pt, fill=black
    },
    irreg/.style={
        decoration={random steps, amplitude=2pt, segment length=10pt, post length=10pt, pre length=10pt}, decorate, rounded corners
    },
} 

\begin{document}
    \begin{center} 
    \begin{tikzpicture}
        \coordinate (centro);
        \node[label={[label distance=-3pt]45:$1$}, mydot, below right=16pt and -8pt of centro] (1) {};
        \node[label={[label distance=-3pt]45:$2$}, mydot, above right=2pt and 12pt of 1] (2) {};
        \node[label={[label distance=-3pt]45:$3$}, mydot, below=12pt of 1] (3) {};
        \node[label={[label distance=-3pt]45:$4$}, mydot, above right=2pt and 12pt of 3] (4) {};
        \node[label={[label distance=-3pt]45:$1$}, mydot, above=6ex of centro] {};
        \node[label={[label distance=-3pt]45:$2$}, mydot, below right=12ex and 4em of centro] {};
        \node[label={[label distance=-3pt]45:$3$}, mydot, below left=12ex and 4em of centro] {};
        \node [left=7em of centro] (a) {$1\dots1$}; 
        \node [right=7em of centro] (b) {$2\dots2$}; 
        \node [below=20ex of centro] (c) {$3\dots3$}; 
        \draw[irreg] ([xshift=-6em]centro) ellipse (10em and 16ex);
        \draw[irreg] ([xshift=6em]centro) ellipse (10em and 16ex);
        \draw[irreg] ([yshift=-16ex]centro) ellipse (6em and 20ex);
        \node[font=\Large,below left=10ex and 14em of centro] {$e_{1}$}; 
        \node[font=\Large,below right=10ex and 14em of centro] {$e_{2}$}; 
        \node[font=\Large,below=37ex of centro] {$e_{3}$}; 
    \end{tikzpicture}
    \end{center}
\end{document}

enter image description here

  • @user326307 You could use \resizebox, see here: tex.stackexchange.com/a/4340/101651. If you have any problem in resizing, please ask a new question with some blind text explaing how you would like your output, we will be happy to answer. Thank you for accepting my answer. – CarLaTeX Dec 12 '17 at 6:54
  • To the downvoter: please explain the reason. Since the OP accepted my answer, perhaps this was what he needed. – CarLaTeX Dec 25 '17 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy