curveseg: Draw a curved segment

Description Usage Arguments Value Examples

View source: R/curveseg.R

Description

Draws a curved segment from point (x0,y0) to (x1,y1). The segment is a framgent of a sinusoid, has a defined width and can either have a single color or a color gradient.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
curveseg(
  x0,
  x1,
  y0,
  y1,
  width = 1,
  nsteps = 50,
  col = "#ffcc0066",
  grad = NULL,
  lty = 1,
  form = c("sin", "line"),
  fix.pdf = 0
)

Arguments

x0

X coordinate of the starting point

x1

X coordinate of the end point

y0

X coordinate of the starting point

y1

X coordinate of the end point

width

Width of the segment to plot

nsteps

Number of polygons to use for the segments. The more, the smoother the picture, but at the same time, the more time-consuming to display.

col

Color to use. Ignored if grad is not NULL.

grad

Gradient to use. Can be anything that colorRampPalette can understand.

lty

Line type for drawing of the segment. Use lty=0 for no line.

form

"sin" for a sinusoidal segment. "line" for a straight segment.

fix.pdf

Draw a border around segments with line type lty in a desperate attempt to fix the PDF output.

Value

no value is returned

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# a DNA strand
plot.new()
par( usr= c( 0, 4, -2.5, 2.5 ) )

w    <- 0.4
cols <- c( "blue", "green" )
init <- c( -0.8, -0.5 )
pos  <- c( 1, -1 )
step <- 0.5

for( i in rep( rep( c( 1, 2 ), each= 2 ), 5 ) ) {
  curveseg( init[i], init[i] + step, pos[1], pos[2], width= w, col= cols[i] )
  init[i] <- init[i] + step
  pos <- pos * -1
}

Example output



riverplot documentation built on Jan. 22, 2021, 5:09 p.m.