如何在基礎 R 圖中旋轉文字?


要在基礎 R 圖中編寫文字,首先我們應該使用 type="n" 建立一個空白圖表,如果我們只想繪製文字,則應該藉助於 text 函式引入文字。現在,如果我們想旋轉文字值,則可以使用 srt 引數。例如,如果我們要將文字旋轉 45 度,則可以使用 srt = -45。

示例 1

實際演示

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

輸出

示例 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+ 瀏覽

啟動你的 職業

完成課程獲得認證

開始
廣告
© . All rights reserved.