我似乎永远不会让文本在绘图中正确旋转,而相同的文本则完全旋转.例如,
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)
给出以下内容.

文字偏斜,难以辨认.如何正确旋转文本?
发生偏斜是因为直接包含文本并且两个轴的比例不相同.如果设置AspectRatio为Automatic比例将相同且文本可读:
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)

要保持纵横比(可能是您想要的),请将文本换行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)

您也可以在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)
这也将避免从宽高比倾斜。

| 归档时间: |
|
| 查看次数: |
2696 次 |
| 最近记录: |