grid.brushXspline: Sweep an X-spline curve with a brush.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/brushxspline.R

Description

Sweep an X-spline curve with a brush; the main curve is described by x/y control points and a variable-size brush is used to sweep a variable-width line from the main curve.

Usage

1
2
3
4
5
6
7
8
9
brushXsplineGrob(brush, x, y, w=unit(1, "cm"), default.units="npc",
                 shape=1, angle="perp", open=TRUE, spacing=NULL,
                 render=vwPath(),
                 gp=gpar(fill="black"), name=NULL, debug=FALSE)
grid.brushXspline(...)

verticalBrush
circleBrush(n=50)
squareBrush

Arguments

brush

A description of a brush shape (see Details). Some simple brushes are provided by verticalBrush and circleBrush.

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.

shape

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

angle

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

open

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

spacing

A numeric vector or unit describing where the brush will be placed along the main curve.

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

n

Number of points to generate on circumference of circle brush.

Details

The brush is described using a list with components x and y. The brush is described in a coordinate system [-1, 1] (in both x and y). The predefined brushes are verticalBrush (thin vertical line), circleBrush (the number of points on the circumference can be controlled), and squareBrush.

By default, the brush is placed at (almost) all points along the main curve. If spacing is specified, then the brush is only placed at those locations on the main curve. If spacing is a numeric vector, the values are assumed to be proportions of the length of the main curve. The spacing is automatically recycled to the cover the full length of the main curve.

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

Value

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

Author(s)

Paul Murrell

See Also

grid.xspline, grid.vwline, grid.vwcurve, grid.offsetXspline, grid.vwXspline

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
grid.newpage()
x <- c(.2, .4, .6, .8)
y <- c(-.05, .05, -.05, .05)
w <- unit(c(2, 4, 6, 8), "mm")
grid.brushXspline(verticalBrush, x, y + .8, w)
grid.brushXspline(verticalBrush, x, y + .6, w,
                  shape=-1)
grid.brushXspline(circleBrush(), x, y + .4, w)
grid.brushXspline(verticalBrush, x, y + .2, w,
                  gp=gpar(col="black"), debug=TRUE)

vwline documentation built on July 25, 2019, 9:03 a.m.