3
$\begingroup$

On a related question to this, I am now experimenting the labelling with the circle points,

With[{n = 150, 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[#, #, #2] &,
                {5 Range@30, ReIm[-1.5 I*a[[5 Range@30]]]}
            ]
        }
    ]
]]

Since it's difficult to label all numbers, I am only labelling every 5 points.

enter image description here

But, I am wondering, is it possible to efficiently change the direction of the texts, so that I CAN then label all points, like this

enter image description here

Or label the numbers by veritcally stacking the digits like this

enter image description here

$\endgroup$
3
$\begingroup$

One possible way: Use the third and fourth arguments of Text to control the alignment and direction:

With[{n = 150, 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[#, #2, {-1, 0}, #2] &,
                      {RotateRight[5 Range@30, 75], 
                       ReIm[-1.05 I a[[5 Range@30]]]}
                  ]
             }
        ]
  ]]

enter image description here

To change the direction of text, use Text[#, #2, {1,0}, -#2] & as the first argument of MapThread:

enter image description here

To get more readable labels, use Text[ #, #2, {d =If[#<=75, -1,1],0}, -d #2] &:

enter image description here

Use Text[Row[Rotate[#, 90 Degree] & /@ IntegerDigits[#], " "], #2, {1,0}, -#2] & to get something similar to your third picture:

enter image description here

Alternatively, you can use

MapThread[Inset[Text@#, #2, Right, Automatic, -#2] &, 
 {RotateRight[5 Range@30, 75], ReIm[-1.05 I a[[5 Range@30]]]}]

and

MapThread[Inset[Text@#, #2, Left, Automatic, #2] &, 
 {RotateRight[5 Range@30, 75], ReIm[-1.05 I a[[5 Range@30]]]}]

to get similar pictures to the the first two pictures above.

$\endgroup$
  • $\begingroup$ I might also have some font size problems to adjust as I can't exactly reproduce using the same code ... but that's very helpful and enough for me to tweak around! $\endgroup$ – Chen Stats Yu Jul 11 '18 at 8:03

Your Answer

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

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