如何在基础 R 图中旋转文字?


要在基础 R 图中编写文字,首先我们应该使用 type="n" 创建一个空白图表,如果我们只想绘制文字,则应该借助于 text 函数引入文字。现在,如果我们想旋转文字值,则可以使用 srt 参数。例如,如果我们要将文字旋转 45 度,则可以使用 srt = -45。

示例 1

实际演示

> plot(1:10,type="n")
> text(x=5,y=5,"Text inside plot")

输出

Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified expert to boost your career.

示例 2

实际演示

> plot(1:10,type="n")
> text(x=5,y=5,"Text inside plot",srt=-20)

输出

示例 3

实际演示

> plot(1:10,type="n")
> text(x=5,y=5,"Text inside plot",srt=-45)

输出

更新日期:2020 年 11 月 7 日

6K+ 浏览

启动你的 职业

完成课程获得认证

开始
广告