Learn R Programming

HelpersMG (version 5.1)

cArrows: Draw curved lines with arrowhead

Description

Draw a curved line with arrowhead.

Usage

cArrows(
  x1,
  y1,
  x2,
  y2,
  code = 2,
  size = 1,
  width = 1.2/4/cin,
  open = TRUE,
  sh.adj = 0.1,
  sh.lwd = 1,
  sh.col = if (is.R()) par("fg") else 1,
  sh.lty = 1,
  h.col = sh.col,
  h.col.bo = sh.col,
  h.lwd = sh.lwd,
  h.lty = sh.lty,
  curved = FALSE,
  beautiful.arrow = 2/3
)

Arguments

x1

coordinates of points from which to draw.

y1

coordinates of points from which to draw.

x2

coordinates of points to which to draw.

y2

coordinates of points to which to draw.

code

integer code (1, 2, or 3), determining kind of arrows to be drawn.

size

size of the arrowhead.

width

width of the arrowhead.

open

shape of the arrowhead.

sh.adj

Shift the beginning of the line.

sh.lwd

width of the line.

sh.col

color of the line.

sh.lty

type of line.

h.col

color of the arrowhead.

h.col.bo

color of the arrowhead border.

h.lwd

width of the arrowhead.

h.lty

type of line for the arrowhead.

curved

0 is a straigth line, positive of negative value make the line curved.

beautiful.arrow

if open is false, make the arrowhead more beautiful.

Value

A list wit lab.x and lab.y being the position where to draw label

Details

cArrows draws curved lines with arrowhead

Examples

Run this code
# NOT RUN {
plot(c(1, 10), c(1, 10), type="n", bty="n")
cArrows(x1=2, y1=2, x2=6, y2=6, curved=1)
cArrows(x1=2, y1=2, x2=6, y2=6, curved=0)
cArrows(x1=2, y1=2, x2=6, y2=6, curved=1, sh.adj=1)
cArrows(x1=2, y1=2, x2=6, y2=6, curved=-1, open=FALSE)
cArrows(x1=9, y1=2, x2=6, y2=6, curved=-1, open=FALSE, sh.col="red")
cArrows(x1=9, y1=9, x2=6, y2=6, curved=-1, open=FALSE, h.col="red")
cArrows(x1=2, y1=9, x2=6, y2=6, curved=1, open=FALSE, h.col="red", h.col.bo="red")
# }

Run the code above in your browser using DataLab