This is an alternative to the grid packages bezierGrob
with the advantage that it allows you to draw an arrow with a specific
unit width. Note, it has only a end-arrow at this point.
A numeric vector or unit object specifying x-locations of
spline control points.
y
A numeric vector or unit object specifying y-locations of
spline control points.
width
The width of the arrow, either a numeric single number or a unit. Note:
The arrow does not rely on lwd but on actual width.
clr
The color of the arrow.
default.units
A string indicating the default units to use
if x or y
are only given as numeric vectors.
arrow
This is a list with all the base (width) and the desired
length for the arrow. Note: This differs from the original
bezierGrob function.
rez
The resolution of the arrow. This specifies how many points to retrieve from the
gnrlBezierPoints function. Defaults to 200.
align_2_axis
Indicates if the arrow should be vertically/horizontally
aligned. This is useful for instance if the arrow attaches to a box.
name
A character identifier.
rm_intersect
Set to 0 if you want to skip intersection removal, 1 only to remove left or
2 to only remove right. See details for why.
@section Remove intersections:
When the line is wide and the arrow has a narrow curve there may appear an empty triangle due
to polygon cancellation (two polygons within the same are cancel out). This behaviour may be
ugly and the function therefor tries to remove these.
Note: it is expensive to check if there are the lineas may intersect at one point,
remove those unexpected, and then adjust the line to the new situation so that the
top and bottom lines match. It can also cause some unexpected behaviour why you may want to
remove this feature if the arrow behaves erratically.
gp
An object of class gpar, typically the output
from a call to the function gpar. This is basically
a list of graphical parameter settings.
vp
A Grid viewport object (or NULL).
Value
grid::grob A grob of the class polygonGrob with attributes that
correspond to the bezier points.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Gmisc)
Loading required package: Rcpp
Loading required package: htmlTable
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Gmisc/bezierArrowSmpl.Rd_%03d_medium.png", width=480, height=480)
> ### Name: bezierArrowSmpl
> ### Title: A simple bezier arrow
> ### Aliases: bezierArrowSmpl
>
> ### ** Examples
>
> library(grid)
> grid.newpage()
> arrowGrob <- bezierArrowSmpl(x = c(.1,.3,.6,.9),
+ y = c(0.2, 0.2, 0.9, 0.9))
> grid.draw(arrowGrob)
>
>
>
>
>
>
> dev.off()
null device
1
>