4
$\begingroup$
Table[
    With[{n = t, k = 2}, 
        With[{a = Exp[-2 Pi*I*Range[1., n]/n]}, 
        Graphics@ GraphicsComplex[
                ReIm[I*Join[a, a^k]], 
                {
                    Circle[], 
                    {Red, PointSize -> Medium, Point@Range@n}, 
                    MapThread[Text[#, #, {0, -1.5}, -#2] &, {RotateRight[Range@n, 0], ReIm[-1.5 I*a]}]
                }]
    ]], {t, 7, 30}
]

Adapting from a previous post (for which I can't find any more), I'd like to draw some blank circles with equal spaced labeled points like so. As you can see, the postions of numbers are not really ideal.

Is there a way to improve this code, so the numbers around the circle looks nicer? I don't want to change the RotateRight[Range@n, 0] for each of them seperately if possible.

Thanks.

$\endgroup$
2
  • $\begingroup$ Where labels supposed to be placed? Near red points, or between? If they should be near, try changing you {0, -1.5} in Text to smth like {-2, 0}. For me it is nice eniugh. $\endgroup$
    – Alx
    Jul 29, 2019 at 14:04
  • $\begingroup$ @Alx Thanks. It does look nicer. I just want the number to be above (outside) the circle and looks vertically aligned to the centre of the circle. Any "normal" looking way is fine. The thing is at the moment, when there are not many points, the numbers are rotated to much, I feel. $\endgroup$
    – CasperYC
    Jul 29, 2019 at 14:33

2 Answers 2

5
$\begingroup$
Table[Graphics[{Circle[], 
    MapIndexed[{Red, PointSize -> Medium, Point @ #,  
       Black, Text[Style[#2[[1]], 14],  1.1 #, {Center, Center}]}&,
      Reverse @ CirclePoints[{0, 0}, {1, Pi/2}, n]]}, ImagePadding -> Scaled[.02]], 
   {n, 7, 10}] 

Row[%, Spacer[5]] 

enter image description here

$\endgroup$
2
$\begingroup$
cycleGraph = CycleGraph[#, 
    ##2,
    VertexLabels -> Placed[Automatic, "Circular"], 
    EdgeStyle -> Opacity[0],
    VertexStyle -> Red, 
    Prolog -> Circle[], 
    ImagePadding -> 15] &;

Examples:

Row[cycleGraph[#, ImageSize -> Small, VertexLabelStyle -> 16] & /@ 
  Range[7, 10], 
  Spacer[10]]

![enter image description here

$\endgroup$
2
  • $\begingroup$ Is VertexLabelStyle -> 16 documented? I found nothing here. $\endgroup$
    – user64494
    Nov 16, 2023 at 16:12
  • $\begingroup$ @user64494, it is not mentioned explicitly in the relevant docs pages. The first and last bullets in VertexLabelStyle > Details suggest why it works; an explicit and direct example in the basic examples would be more useful, of course, $\endgroup$
    – kglr
    Nov 16, 2023 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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