Learn R Programming

sequence (version 2.0)

smartArrow: Draws a 'smart' arrow between two points.

Description

Draws a 'smart' arrow between two points surrounded by a circle of known radius. The arrow is arc shaped and ends with an arrowhead.

Usage

smartArrow(A = c(0, 2), B = c(2, 2), Ra = 0.2, Rb = 0.1, ClegA = "A", 
ClegB = "B", width = 0.1, col = "lightgreen", ccol = "yellow", 
density = NULL, angle = 0, marge = 1.3, debord = 1.4, plot = FALSE, 
trace = TRUE)

Arguments

A

numeric vector: coordinates of point A.

B

numeric vector: coordinatess of point B.

Ra

numeric: Radius of circle A

Rb

numeric: Radius of circle B

ClegA

character: label of circle A

ClegB

character: label of circle B

width

numeric: width of the arrow

col

color to fill the arrow. Seepolygon

ccol

color to fill the circle. See symbols

density

numeric: density of shading lines per inch (default=NULL). See polygon

angle

numeric: angle of shading lines in radians (default = 0). See polygon

marge

numeric: Angular distance between each circle and the corresponding end of the arrow (default = 1.3).

debord

numeric: overflow of the arrowhead relatively to its body. (Default = 1.4)

plot

logical: to draw a first arrow on a new plot.(Default = FALSE)

trace

logical: if TRUE (default) the arrow is drawn, else it is simply calculated.

Value

An object of class smartarrow having attributes:

arrow

The polygon representing the arrow.

bg

Color of background

A

Coordinates of point A

B

Coordinates of point B

Ra

Radius of circle A

Rb

Radius of circle B

left

The most extreme left point of the set circles-arrows.

right

The most extreme right point of this set

up

The most extreme high point.

down

The most extreme low point

drawcircles

boolean : draw the circles or not.

Details

SmartArrow can work both as a high level and a low level function, depending on the value of the argument plot. Used in flux. Not supposed to be used directly by the user.

See Also

flux, polygon,symbols arrows ~ for simple arrows

Examples

Run this code
# NOT RUN {

# For a quick illustration
   smartArrow(plot=TRUE)
# an arrow from a randomly drawn point on [0,2]x[0,2]
   smartArrow(B=runif(2,0,2),Rb=runif(1,0,0.5),ClegB="C")
# }

Run the code above in your browser using DataLab