I am writing an essay about partitions of a set. I would like to illustrate partitions on a circle. In order to do that i would like to draw a circle, mark points on it and connect some of them with a line. The desire output would look like this: enter image description here

In my essay I will have a lot of examples so I would like to know how to do it with any amount of points and how to draw any line that connects points on a circle. I think that tikz package would be useful. I know how to draw circle, points and lines using tikz, but i cant get my head around about how to connect this things.


2 Answers 2


A possibility is to do a marco that draws the set (the circle) and the points, and that names each one. Then all you have to do is connect the desired points. It could be something like this:


% Macro
\def\r{2} % raduis
\newcommand{\myset}[4] % name, position x, position y, number of points
    \coordinate (#1) at (0,0) {};
    \draw (0,0) circle (\r);
    \foreach\i in {1,...,#4}
      \coordinate (#1-\i) at (\thisangle:\r);
      \node at (\thisangle:1.1*\r) {$\i$};
      \fill (\thisangle:\r) circle (1pt);  

\begin{tikzpicture}[line join=round, line cap=round]
  % A set with 8 points
  \draw (S1-1) -- (S1-3) -- (S1-8) -- cycle;
  \draw (S1-5) -- (S1-7);
  % Anotehr set with 10 points
  \draw (S2-2) -- (S2-5) -- (S2-7) -- (S2-9) -- cycle;
  \draw (S2-6) -- (S2-8);

enter image description here


I propose this short code based on the pst-poly pstricks package:

\documentclass[x11names, border = 3pt]{standalone}%


\psset{unit = 1.25}
        \psdots[dotstyle=o, dotsize=2pt,fillstyle = solid, fillcolor=IndianRed3](1;\INode)}
    \psset{ linewidth = 0.6pt}
    \rput(0,0){\PstOctogon[linestyle = none, PolyName=A, PolyRotation=45]}
    \psset{nodesep=1pt, linecolor=LightSteelBlue3}
\multido{\i=3+1,\Id=8 + -1, \na=112.5+45}{6}{\nput{\na}{A\i}{\scriptsize\Id}}


enter image description here

You must log in to answer this question.

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