# Direction of text when labelling graphs

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},
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.

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

Or label the numbers by veritcally stacking the digits like this

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]]]}
]
}
]
]]


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

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

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

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.

• 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! – Chen Stats Yu Jul 11 '18 at 8:03