A numeric vector or unit object specifying x-values.
y
A numeric vector or unit object specifying y-values.
default.units
A string indicating the default units to use
if x or y are only given as numeric vectors.
arrow
A list describing arrow heads to place at either end
of the line, as produced by the arrow function.
name
A character identifier.
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.
draw
A logical value indicating whether graphics output
should be produced.
vp
A Grid viewport object (or NULL).
id
A numeric vector used to separate locations in x and
y into multiple lines. All locations with the same
id belong to the same line.
id.lengths
A numeric vector used to separate locations in x and
y into multiple lines. Specifies consecutive blocks of
locations which make up separate lines.
...
Arguments passed to polylineGrob.
Details
The first two functions create a lines grob (a graphical object describing
lines), and grid.lines
draws the lines (if draw is TRUE).
The second two functions create or draw a polyline grob,
which is just like a lines grob, except that there can be
multiple distinct lines drawn.
Value
A lines grob or a polyline grob.
grid.lines returns a lines grob invisibly.
Author(s)
Paul Murrell
See Also
Grid,
viewport,
arrow
Examples
grid.lines()
# Using id (NOTE: locations are not in consecutive blocks)
grid.newpage()
grid.polyline(x=c((0:4)/10, rep(.5, 5), (10:6)/10, rep(.5, 5)),
y=c(rep(.5, 5), (10:6/10), rep(.5, 5), (0:4)/10),
id=rep(1:5, 4),
gp=gpar(col=1:5, lwd=3))
# Using id.lengths
grid.newpage()
grid.polyline(x=outer(c(0, .5, 1, .5), 5:1/5),
y=outer(c(.5, 1, .5, 0), 5:1/5),
id.lengths=rep(4, 5),
gp=gpar(col=1:5, lwd=3))
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.lines.Rd_%03d_medium.png", width=480, height=480)
> ### Name: grid.lines
> ### Title: Draw Lines in a Grid Viewport
> ### Aliases: grid.lines linesGrob grid.polyline polylineGrob
> ### Keywords: dplot
>
> ### ** Examples
>
> grid.lines()
> # Using id (NOTE: locations are not in consecutive blocks)
> grid.newpage()
> grid.polyline(x=c((0:4)/10, rep(.5, 5), (10:6)/10, rep(.5, 5)),
+ y=c(rep(.5, 5), (10:6/10), rep(.5, 5), (0:4)/10),
+ id=rep(1:5, 4),
+ gp=gpar(col=1:5, lwd=3))
> # Using id.lengths
> grid.newpage()
> grid.polyline(x=outer(c(0, .5, 1, .5), 5:1/5),
+ y=outer(c(.5, 1, .5, 0), 5:1/5),
+ id.lengths=rep(4, 5),
+ gp=gpar(col=1:5, lwd=3))
>
>
>
>
>
> dev.off()
null device
1
>