grid.vwcurve: Draw a variable-width smooth curve.

View source: R/vwcurve.R

grid.vwcurveR Documentation

Draw a variable-width smooth curve.

Description

Draw a variable-width line where the main line is a series of straight line segments that are assumed to be a flattened approximation to a smooth curve and the width is specified at each vertex along the flattened curve.

Usage

vwcurveGrob(x, y, w, default.units="npc", open=TRUE, angle="perp",
           lineend="butt", mitrelimit=4,
           render=if (open) vwPolygon else vwPath(),
           gp=gpar(fill="black"), name=NULL, debug=FALSE)
grid.vwcurve(...)

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.

angle

Either "perp" or a numeric value describing a fixed orientation for the line width.

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.

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 vwcurveGrob.

Details

The widths are calculated perpendicular to the average angle at each vertex (or just perpendicular to the line segment for the first and last vertex), unless a numeric angle is specified, in which case the widths are calculated at that angle at every vertex.

Value

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

Author(s)

Paul Murrell

See Also

grid.vwline, grid.vwXspline, grid.brushXspline, grid.offsetXspline

Examples

grid.newpage()
x <- seq(.2, .8, length.out=100)
y <- .05*sin(seq(0, 2*pi, length.out=100))
w <- unit(seq(2, 10, length.out=100), "mm")
grid.vwcurve(x, y + .8, w)
grid.vwcurve(x, y + .6, w,
             angle=45)
grid.vwcurve(x, y + .4, w,
             lineend="round")
grid.vwcurve(x, y + .2, w,
             gp=gpar(col="black"), debug=TRUE)

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

Related to grid.vwcurve in vwline...