Last data update: 2014.03.03

R: Move or Draw to a Specified Position
grid.move.toR Documentation

Move or Draw to a Specified Position

Description

Grid has the notion of a current location. These functions sets that location.

Usage

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)

Arguments

x

A numeric value or a unit object specifying an x-value.

y

A numeric value or a unit object specifying a y-value.

default.units

A string indicating the default units to use if x or y are only given as numeric values.

arrow

A list describing arrow heads to place at either end of the line, as produced by the arrow function.

name

A character identifier.

draw

A logical value indicating whether graphics output should be produced.

gp

An object of class gpar, typically the output from a call to the function gpar. This is basically a list of graphical parameter settings.

vp

A Grid viewport object (or NULL).

Details

Both functions create a move.to/line.to grob (a graphical object describing a move-to/line-to), but only grid.move.to/line.to() draws the move.to/line.to (and then only if draw is TRUE).

Value

A move.to/line.to grob. grid.move.to/line.to() returns the value invisibly.

Author(s)

Paul Murrell

See Also

Grid, viewport, arrow

Examples

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, w=0.25, h=0.25, just=c("left", "bottom")))
grid.rect()
grid.grill()
grid.line.to(0.5, 0.5)
popViewport()

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(grid)
> png(filename="/home/ddbj/snapshot/RGM3/R_rel/result/grid/grid.move.to.Rd_%03d_medium.png", width=480, height=480)
> ### Name: grid.move.to
> ### Title: Move or Draw to a Specified Position
> ### Aliases: grid.move.to grid.line.to moveToGrob lineToGrob
> ### Keywords: dplot
> 
> ### ** Examples
> 
> 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, w=0.25, h=0.25, just=c("left", "bottom")))
> grid.rect()
> grid.grill()
> grid.line.to(0.5, 0.5)
> popViewport()
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>