# Drawing a set partition

I want to reproduce this diagram

What I tried :

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (0,0) ellipse (3cm and 2cm);

\foreach \i in {1,...,5}
\draw (0,0) -- ({360/5*\i}:3cm);

\foreach \i/\label in {1/A_1, 2/A_2, 3/A_3, 4/A_4, 5/A_5}
\node at ({360/5*(\i-0.5)}:2.5cm) {$$\label$$};

\node at (-2.5cm,2.5cm) {$\Omega$};
\end{tikzpicture}
\end{document}


The result

• Are the curves specific or do you just need to approximate the shape? Commented Mar 31 at 19:10
• Approximating the shape is okay yes
– Dots
Commented Mar 31 at 19:12
• @Dots You chould learn to draw Bézier curves with TikZ. Commented Mar 31 at 19:13

## 4 Answers

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\draw (0,0) ellipse[x radius=3cm, y radius=2cm];
\foreach \i in {1,...,5} \path ({360/5*\i}:3cm and 2cm) coordinate (A\i);
\path (-2.5,0) node {$\mathrm{A}_1$};
\path (130:0.6*3cm and 0.6*2cm) node {$\mathrm{A}_2$};
\path (280:0.1*3cm and 0.1*2cm) node {$\mathrm{A}_3$};
\path (30:0.7*3cm and 0.7*2cm) node {$\mathrm{A}_4$};
\path (-30:0.7*3cm and 0.7*2cm) node {$\mathrm{A}_5$};
\draw[name path=curve]
(A4)
.. controls +(110:0.5) and +(-5:0.5) ..
(A1)
.. controls +(175:0.5) and +(-60:0.5) ..
(A3)
.. controls +(120:0.5) and +(-30:1.5) ..
(A2);
\path[name path=line] (0,0) -- (3,0);
\path[name intersections={of=curve and line, by=Z}];
\draw (Z) -- (3,0);
\path (160:3cm and 2cm) coordinate (A);
\path (A) ++(160:1cm) node[circle, draw] (omega) {$\Omega$};
\draw (omega) -- (A);
\end{tikzpicture}
\end{document}


Just for fun. Here is a way do it.

\documentclass[border=0.618cm]{standalone}
\usepackage{tikz}
\usetikzlibrary {shapes.geometric}

\begin{document}
\begin{tikzpicture}[line width=1.5pt]
%The empty ellipse node with minimum width 6cm and minimum height 4cm
\node [ellipse,draw,minimum width=6cm, minimum height=4cm] (ep) at (0,0) {};

%Draw the Bézier curve and the horizontal line to make segments inside the ellipse
\draw ([shift={(0.5\pgflinewidth,-0.5\pgflinewidth)}]ep.145)
.. controls ++(1.2,-1) and ++(-0.2,0.2)
.. ([shift={(0.5\pgflinewidth,0.5\pgflinewidth)}]ep.215)
.. controls ++(0.2,-0.2) and ++ (-0.3,0.2)
.. ([shift={(-0.5\pgflinewidth,-0.5\pgflinewidth)}]ep.60)
.. controls ++(0.3,-0.2) and ++(0,0)
.. node (mp) [pos=0.485] {}  ([yshift=0.5\pgflinewidth]ep.-65);
\draw (mp.center) -- ([xshift=-0.5\pgflinewidth]ep.east);

%Draw label omega outside the ellipse
\node (lb) [draw,circle] at ([shift={(-0.5,0.5)}]ep.155) {$\Omega$};
\draw (ep.155) -- (lb);

%Draw the labels for each segment
\node at ([xshift=0.75cm]ep.west) {$A_1$};
\node at ([shift={(-0.75cm,1cm)}]ep.center) {$A_2$};
\node at ([shift={(0.1cm,-0.7cm)}]ep.center) {$A_3$};
\node at ([shift={(1.95cm,0.75cm)}]ep.center) {$A_4$};
\node at ([shift={(1.95cm,-0.75cm)}]ep.center) {$A_5$};
\end{tikzpicture}
\end{document}


I tried without using the bezier curves. Also, I made the output a bit customizable in the width and height of the ellipse. Maybe this is a naive approach, but I wanted to share an option without imagining the controls option of bezier curves.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[inner sep=0pt, outer sep=0pt,very thick]

% ellipse centre and axis
\coordinate (O) at (0,0);
\def\A{3.5}
\def\B{2}
% circle centre
\coordinate (C) at ($(O)+(145:{1.5*\A} and {1.5*\B})$);

% ellipse
\draw (O) ellipse ({\A} and {\B});

% inside borders
\foreach \n/\i in {1/130,2/232,3/70,4/285,5/355}
\coordinate (A\n) at ($(O)+(\i:{\A} and {\B})$);

\coordinate (A2I) at (229:{0.95*\A} and {0.95*\B});
\coordinate (A2O) at (233:{0.95*\A} and {0.95*\B});
\coordinate (A3I) at (74:{0.9*\A} and {0.9*\B});
\coordinate (A3O) at (66:{0.9*\A} and {0.9*\B});

\draw (A1)  to[out=320, in=65]
(A2I) to[out=245, in=125]
(A2)  to[out=-25, in=230]
(A2O) to[out=50,  in=220]
(A3I) to[out=40,  in=180]
(A3)  to[out=320, in=90]
(A3O) to[out=270, in=90] node[name=M,pos=0.45]{}
(A4);
\draw (M)--(A5);

% circle
\draw (C) circle (0.5);
\coordinate (Om1) at ($(O)+(150:{\A} and {\B})$);
\coordinate (Om2) at ($(C)+(150+180:0.5)$);
\draw (Om1)--(Om2);

% labels
\node at (C){$\Omega$};
\node at (180:{0.7*\A} and {0.7*\B}){$A_1$};
\node at (125:{0.5*\A} and {0.5*\B}){$A_2$};
\node at (280:{0.2*\A} and {0.2*\B}){$A_3$};
\node at (35:{0.7*\A} and {0.7*\B}){$A_4$};
\node at (320:{0.7*\A} and {0.7*\B}){$A_5$};

\end{tikzpicture}
\end{document}


• They are also bézier curves, even if the syntax does not resemble them. Commented Apr 1 at 5:08
• Oh, sorry, my bad. I wasn't aware of that. If I may ask, are there other options for the to[...] command to control the curve? Because I find it more intuitive than the controls +... command. Commented Apr 1 at 18:15
• The options are described in section 74.3 Curves of the manual. In TikZ all curves, ellipses, circles are written with Bezier curves, regardless of the syntax used to draw this curve. Commented Apr 1 at 18:33
• thank you so much Commented Apr 1 at 19:19

With the decorations.markings library, I place nodes on the ellipse which are numbered (mark-1) to (mark-5), I add the node (mi). With bezier curves I trace the curves. And with the barycentric coordinates, I place the labels A_1 etc.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary {decorations.markings,calc,positioning}

\usepackage{alphalph}
\begin{document}
\tikzset{cmark/.style={decoration={
markings,mark=at position #1 with {\coordinate[name={mark-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}}];}},postaction={decorate}},
mimark/.style={decoration={
markings,mark=at position .5 with {\coordinate[name=mi];}},postaction={decorate}}
}

\begin{tikzpicture}
\draw [cmark/.list={0,.2,.4,.45,.6,.8}](0,0) ellipse (3cm and 2cm);
\draw (mark-3)to[controls=+(-40:1.5) and +(120:.5)]
(mark-5)to[controls=+(-30:.5) and +(170:1)]
(mark-2);
\draw[mimark]   (mark-2)to [controls=+(-10:.5) and +(110:.5)](mark-6);
\draw(mark-1)--(mi);
\node at (barycentric cs:mark-3=1,mark-5=1) {$A_1$};
\node at (barycentric cs:mark-3=1,mark-5=1 ,mark-2=1) {$A_2$};
\node at (barycentric cs:mark-6=1,mark-5=1 ,mark-2=1) {$A_3$};
\node at (barycentric cs:mi=1,mark-1=1 ,mark-2=1) {$A_4$};
\node at (barycentric cs:mi=1,mark-1=1 ,mark-6=1) {$A_5$};
\node[above left=2mm and 4mm of mark-4,draw,circle,inner sep=1pt]{$\Omega$} edge (mark-4);
\end{tikzpicture}
\end{document}