grid.offsetXspline: Draw an X-spline offset curve.

View source: R/offsetxspline.R

grid.offsetXsplineR Documentation

Draw an X-spline offset curve.

Description

Draw an X-spline offset curve; the main curve is described by x/y control points and offset X-splines are calculated to the left and right of the main curve at the specified widths.

Usage

offsetXsplineGrob(x, y, w, default.units="npc", shape=1,
                  open=TRUE, repEnds=TRUE, 
                  lineend="butt", mitrelimit=4,
                  render=if (open) vwPolygon else vwPath(),
                  gp=gpar(fill="black"), name=NULL, debug=FALSE)
grid.offsetXspline(...)

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

default.units

The units used if x or y are numeric vectors.

shape

A numeric value (or one per location) that controls the shape of the X-spline curve relative to the locations.

open

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

repEnds

A logical indicating whether to replicate the first and last control points (so that the X-spline starts and ends at the first and last control points). Can also be the special value "extend", in which case the first and last control segments are extended (and the resulting X-spline is a little curvier at the ends).

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

Details

See grid.xspline for more about the behaviour of X-splines.

Value

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

Author(s)

Paul Murrell

See Also

grid.xspline, grid.vwline, grid.vwcurve, grid.brushXspline, grid.vwXspline

Examples

grid.newpage()
x <- c(.2, .4, .6, .8)
y <- c(-.05, .05, -.05, .05)
w <- unit(c(2, 4, 6, 8), "mm")
grid.offsetXspline(x, y + .8, w)
grid.offsetXspline(x, y + .6, w,
                   shape=-1)
grid.offsetXspline(x, y + .4, w,
                   lineend="round")
grid.offsetXspline(x, y + .2, w,
                   gp=gpar(col="black"), debug=TRUE)

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