當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R grid.move.to 移動或繪製到指定位置

R語言 grid.move.to 位於 grid 包(package)。

說明

網格具有當前位置的概念。這些函數設置該位置。

用法

grid.move.to(x = 0, y = 0, default.units = "npc", name = NULL,
             draw = TRUE, vp = NULL)

moveToGrob(x = 0, y = 0, default.units = "npc", name = NULL,
           vp = NULL)

grid.line.to(x = 1, y = 1, default.units = "npc",
             arrow = NULL, name = NULL,
             gp = gpar(), draw = TRUE, vp = NULL)

lineToGrob(x = 1, y = 1, default.units = "npc", arrow = NULL,
           name = NULL, gp = gpar(), vp = NULL)

參數

x

指定 x-value 的數值或單位對象。

y

指定 y-value 的數值或單位對象。

default.units

指示 xy 僅以數值形式給出時使用的默認單位的字符串。

arrow

說明要放置在行兩端的箭頭的列表,由 arrow 函數生成。

name

字符標識符。

draw

指示是否應生成圖形輸出的邏輯值。

gp

"gpar" 的對象,通常是調用函數 gpar 的輸出。這本質上是圖形參數設置的列表。

vp

網格視口對象(或 NULL)。

細節

這兩個函數都會創建 move.to/line.to grob(說明 move-to/line-to 的圖形對象),但隻有 grid.move.to/line.to() 繪製 move.to/line.to(並且僅當 drawTRUE)。

move.to/line.to grob。 grid.move.to/line.to() 以不可見方式返回值。

例子

grid.newpage()
grid.move.to(0.5, 0.5)
grid.line.to(1, 1)
grid.line.to(0.5, 0)
pushViewport(viewport(x=0, y=0, width=0.25, height=0.25, just=c("left", "bottom")))
grid.rect()
grid.grill()
grid.line.to(0.5, 0.5)
popViewport()

作者

Paul Murrell

也可以看看

Gridviewportarrow

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Move or Draw to a Specified Position。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。