如何使文本正确旋转?
我似乎永远无法让文本在绘图内正确旋转,而相同的文本则可以完美旋转。例如,
Plot[Sin[x], {x, -2 Pi, 2 Pi},
Epilog ->
First@Graphics[Rotate[Text["Sine", {Pi, 1/2}], -30 Degree]]]
给出以下内容。
文本倾斜且难以辨认。如何正确旋转文本?
I can never seem to get text to rotate correctly inside a plot, whereas the same text rotates perfectly otherwise. For example,
Plot[Sin[x], {x, -2 Pi, 2 Pi},
Epilog ->
First@Graphics[Rotate[Text["Sine", {Pi, 1/2}], -30 Degree]]]
gives the following.
The text is skewed and hardly legible. How do I rotate the text correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以在
Text
内移动Rotate
:这也可以避免宽高比的倾斜。
You can also move the
Rotate
inside theText
:which will also avoid the skewing from the aspect ratio.
发生倾斜是因为直接包含文本并且两个轴的比例不一样。如果将
AspectRatio
设置为Automatic
,则比例将相同并且文本可读:要保持宽高比(这可能是您想要的),请将文本换行在
Inset
中:The skewing happens because the text is directly included and the scale of the two axis is not the same. If you set
AspectRatio
toAutomatic
the scale will be the same and the text is readable:To keep the aspect ratio (which is probably what you want), wrap the text in
Inset
: