grid.brushXspline | R Documentation |
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.
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
brush |
A description of a brush shape (see Details). Some
simple brushes are provided by |
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 |
default.units |
The units used if |
shape |
A numeric value (or one per location) that controls the shape of the X-spline curve relative to the locations. |
angle |
Either |
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 |
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 |
n |
Number of points to generate on circumference of circle brush. |
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.
grid.brushXspline
is used for its side-effect of drawing a
variable-width
line; brushXsplineGrob
returns a "brushXsplineGrob"
object.
Paul Murrell
grid.xspline
,
grid.vwline
,
grid.vwcurve
,
grid.offsetXspline
,
grid.vwXspline
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.