grid.vwline: Draw a variable-width set of line segments.

View source: R/vwline.R

grid.vwlineR Documentation

Draw a variable-width set of line segments.

Description

Draw a variable-width line where the main line is a series of straight line segments and the width is specified at each vertex and linearly interpolated along each segment.

Usage

vwlineGrob(x, y, w, default.units="npc", open=TRUE, 
           linejoin="round", lineend="butt", mitrelimit=4,
           stepWidth=FALSE, render=if (open) vwPolygon else vwPath(),
           gp=gpar(fill="black"), name=NULL, debug=FALSE)
grid.vwline(...)

Arguments

x

A numeric vector or unit describing x-locations.

y

A numeric vector or unit describing y-locations.

w

A numeric vector or unit describing widths at each location, or a width specification generated by widthSpec.

default.units

The units used if x or y are numeric vectors.

open

A boolean indicating whether to connect the last location back to the first location to produce a closed line.

linejoin

The line join style; one of "round", "mitre", or "bevel".

lineend

The line ending style; one of "round", "mitre", "butt", or "square".

mitrelimit

A numeric that controls when a mitre join is converted to a bevel join or a mitre ending is converted to a square ending.

stepWidth

A logical indicating whether widths are fixed along the length of a segment.

render

A function that is used to render the outline of the path that is generated for the variable-width line.

gp

A set of graphical parameters; see gpar.

name

A name for the grob generated for the variable-width line.

debug

A logical indicating whether to produce graphical debugging output.

...

Arguments passed to vwlineGrob.

Details

If stepWidth is TRUE, the last width value is ignored.

Value

grid.vwline is used for its side-effect of drawing a variable-width line; vwlineGrob returns a "vwlineGrob" object.

Author(s)

Paul Murrell

See Also

grid.vwcurve, grid.vwXspline, grid.brushXspline, grid.offsetXspline

Examples

grid.newpage()
grid.vwline(c(.2, .5, .8), rep(.8, 3), unit(c(1, 3, 2), "cm"))
grid.vwline(c(.2, .5, .8), rep(.6, 3), unit(c(1, 3, 2), "cm"),
            stepWidth=TRUE)
grid.vwline(c(.2, .5, .8), rep(.4, 3), unit(c(1, 3, 2), "cm"),
            linejoin="mitre", lineend="round")
grid.vwline(c(.2, .5, .8), rep(.2, 3), unit(c(1, 3, 2), "cm"),
            gp=gpar(col="black"), debug=TRUE)

vwline documentation built on Sept. 11, 2024, 7:56 p.m.

Related to grid.vwline in vwline...