2
$\begingroup$

I want to rotate text in a plot. When I rotate by 90 degrees, or 180, it's perfectly OK. But if I want to rotate to 60 or 45 degrees, then the text appears distorted (see example below). How can I fix it?

Plot[x^2, {x, -10, 10}, 
 Epilog -> {
   Rotate[
    Text[Style["hi" // StandardForm // DisplayForm, FontFamily -> "Helvetica", FontSize -> 20], {2, 80}], 
    90 Degree
   ], 
   Rotate[
    Text[Style["bye", FontFamily -> "Helvetica", FontSize -> 12], {1, 20}],
    45 Degree
   ]
 }
]

enter image description here

$\endgroup$

1 Answer 1

5
$\begingroup$

Use Rotate inside Text (or Inset), rather than the other way round:

Plot[
  x^2, {x, -10, 10},
  Epilog -> Text[Rotate[Style["bye", 20], 45 Degree], {1, 20}]
]

correct orientation of text with no stretching

$\endgroup$
2
  • $\begingroup$ Thanks very much, it really helped. $\endgroup$
    – lia
    Nov 28, 2023 at 21:22
  • $\begingroup$ @lia You are very welcome. $\endgroup$
    – MarcoB
    Nov 28, 2023 at 21:22

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.