Last chance! 50% off unlimited learning
Sale ends in
grid.lines(x = unit(c(0, 1), "npc"),
y = unit(c(0, 1), "npc"),
default.units = "npc",
arrow = NULL, name = NULL,
gp=gpar(), draw = TRUE, vp = NULL)
linesGrob(x = unit(c(0, 1), "npc"),
y = unit(c(0, 1), "npc"),
default.units = "npc",
arrow = NULL, name = NULL,
gp=gpar(), vp = NULL)
grid.polyline(...)
polylineGrob(x = unit(c(0, 1), "npc"),
y = unit(c(0, 1), "npc"),
id=NULL, id.lengths=NULL,
default.units = "npc",
arrow = NULL, name = NULL,
gp=gpar(), vp = NULL)
x
or y
are only given as numeric vectors.arrow
function.gpar
, typically the output
from a call to the function gpar
. This is basically
a list of graphical parameter settings.x
and
y
into multiple lines. All locations with the same
id
belong to the same line.x
and
y
into multiple lines. Specifies consecutive blocks of
locations which make up separate lines.polylineGrob
.grid.lines
returns a lines grob invisibly.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.viewport
,
arrow
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))
Run the code above in your browser using DataLab