adds part of a colored and rotated ellipse to a plot

Description

adds (part of) a colored, and rotated ellipse to a plot; an arrow can be drawn at a specified position.

Usage

1
2
3
4
5
6
plotellipse(rx = 1, ry = 0.2, mid = c(0,0), dr = 0.01, 
            angle = 0, from = -pi, to = pi, type = "l", lwd = 2,
            lcol = "black", col = NULL, arrow = FALSE, 
            arr.length = 0.4, arr.width = arr.length*0.5, 
            arr.type = "curved", arr.pos = 1, arr.code = 2, 
            arr.adj = 0.5, arr.col = "black", ...)

Arguments

rx

long radius of ellipse.

ry

short radius of ellipse.

mid

midpoint of ellipse.

dr

size of segments, in radians, to draw ellipse (decrease for smoother).

angle

rotation angle, degrees.

from

starting angle for ellipse segment, radians.

to

final angle for ellipse segment, radians.

type

external line or points; "n" if no line.

lwd

width of external line.

lcol

line color.

col

fill color.

arrow

drawing arrowhead yes/no.

arr.length

length of arrowhead.

arr.width

width of arrowhead.

arr.type

type of arrow.

arr.pos

position of arrow, 0=start,1=end.

arr.code

integer code determining kind of arrows to draw.

arr.adj

adjustment of arrow.

arr.col

color of arrow head.

...

arguments passed to R-function lines.

Details

rx and ry are the horizontal and vertical radiusses of the ellipses.

The ellipse is drawn from the point defined by from to the point defined as to which are joined anti-clockwise.

if arrow is TRUE, an arrow is drawn along the path of the ellipse.

arr.length and arr.width set the size of the arrow.

The type of the arrowhead is set with arr.type which can take the values:

  • "simple" : uses comparable R function arrows.

  • "triangle": uses filled triangle.

  • "curved" : draws arrowhead with curved edges.

  • "circle" : draws circular head.

arr.pos, a real value between 0 and 1 gives the position (0=start,1=end).

arr.col specifies the color, arr.code specifies where the angle points to.

arr.adj specifies the position adjustment - see Arrows for details.

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

See Also

getellipse, filledellipse, plotcircle.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
emptyplot(c(-1, 1), main = "plotellipse")
plotellipse(rx = 0.8, ry = 0.3, angle = 60, col = "blue")
plotellipse(rx = 1.0, ry = 0.6, angle = 0, from = pi, to = 2*pi,
            arrow = TRUE, arr.pos = seq(0.1, 0.5, by = 0.1),
            arr.col = rainbow(5))
plotellipse(rx = 1.0, ry = 0.6, angle = 30, from = pi, to = 1.2*pi,
            col = "red")
plotellipse(rx = 0.1, ry = 0.6, from = 1.5*pi, to = pi,
            lcol = "orange", mid = c(0.2,0.2))
plotellipse(rx = 0.1, ry = 0.6, angle = 30, from = 1.5*pi, to = pi,
            lcol = "orange", mid = c(0.2,0.2))