如何让文本正确旋转?

7 wolfram-mathematica

我似乎永远不会让文本在绘图中正确旋转,而相同的文本则完全旋转.例如,

Plot[Sin[x], {x, -2 Pi, 2 Pi}, 
 Epilog -> 
  First@Graphics[Rotate[Text["Sine", {Pi, 1/2}], -30 Degree]]]
Run Code Online (Sandbox Code Playgroud)

给出以下内容.

在此输入图像描述

文字偏斜,难以辨认.如何正确旋转文本?

Jan*_*nus 6

发生偏斜是因为直接包含文本并且两个轴的比例不相同.如果设置AspectRatioAutomatic比例将相同且文本可读:

Plot[Sin[x], {x, -2 Pi, 2 Pi}, 
 Epilog -> First@Graphics[Rotate[Text["Sine", {Pi, 1/2}], -30 Degree]],
 AspectRatio -> Automatic
]
Run Code Online (Sandbox Code Playgroud)

Mathematica图形

要保持纵横比(可能是您想要的),请将文本换行Inset:

Plot[Sin[x], {x, -2 Pi, 2 Pi},
 Epilog -> Inset[Rotate[Text["Sine"], -70 Degree], {Pi, 1/2}]
]
Run Code Online (Sandbox Code Playgroud)

Mathematica图形


Bre*_*ion 5

您也可以在Rotate内部移动Text

Plot[Sin[x], {x, -2 Pi, 2 Pi}, 
 Epilog -> Text[Rotate["Sine", -70 Degree], {Pi, 1/2}]]
Run Code Online (Sandbox Code Playgroud)

这也将避免从宽高比倾斜。 旋转文字