如何让文本正确旋转?

时间:2011-03-24 04:19:58

标签: wolfram-mathematica

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

Plot[Sin[x], {x, -2 Pi, 2 Pi}, 
 Epilog -> 
  First@Graphics[Rotate[Text["Sine", {Pi, 1/2}], -30 Degree]]]

给出以下内容。

enter image description here

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

2 个答案:

答案 0 :(得分:5)

发生倾斜是因为直接包含文本并且两个轴的比例不相同。如果您将AspectRatio设置为Automatic,则比例将相同且文字可读:

Plot[Sin[x], {x, -2 Pi, 2 Pi}, 
 Epilog -> First@Graphics[Rotate[Text["Sine", {Pi, 1/2}], -30 Degree]],
 AspectRatio -> Automatic
]

Mathematica graphics

要保持宽高比(可能是您想要的),请将文字换成Inset

Plot[Sin[x], {x, -2 Pi, 2 Pi},
 Epilog -> Inset[Rotate[Text["Sine"], -70 Degree], {Pi, 1/2}]
]

Mathematica graphics

答案 1 :(得分:4)

您还可以移动Rotate内的Text

Plot[Sin[x], {x, -2 Pi, 2 Pi}, 
 Epilog -> Text[Rotate["Sine", -70 Degree], {Pi, 1/2}]]

这也可以避免宽高比的偏差。 rotated text

相关问题