View source: R/offsetxspline.R
grid.offsetXspline | R Documentation |
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.
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(...)
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. |
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 |
lineend |
The line ending style; one of |
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 |
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 |
See grid.xspline
for more about the behaviour of X-splines.
grid.offsetXspline
is used for its side-effect of drawing a
variable-width
line; offsetXsplineGrob
returns a "offsetXsplineGrob"
object.
Paul Murrell
grid.xspline
,
grid.vwline
,
grid.vwcurve
,
grid.brushXspline
,
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.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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.