ellipse: Add an ellipse in an existing plot

View source: R/ellipse.R

ellipseR Documentation

Add an ellipse in an existing plot

Description

Add an ellipse in an existing plot

Usage

ellipse(
  x0 = 0,
  y0 = 0,
  a = 1,
  b = 2,
  alpha = 0,
  length = 1000,
  col = NULL,
  fill = NA,
  border,
  ...
)

Arguments

x0

x-coordinate of the ellipse center

y0

y-coordinate of the ellipse center

a

Length of semi-major axis

b

Length of semi-minor axis

alpha

Rotation of the ellipse with regard to the X-axis in radian

length

How many points are generated to simulate the ellipse

col

Ellipse border color

fill

Ellipse fill color

border

Equivalent to col

...

further parameters passed to polygon

Value

Invisible coordinates of points on the ellipse

Examples



if(interactive()) {
  plot.new()
  plot.window(xlim=c(-1, 1), ylim=c(-1,1))
  ellipseCols <- heat.colors(11)
  ellipse(0, 0, a=1, b=0.5, alpha=0)
  for(i in 1:11) {
    ellipse(0, 0, a=1, b=0.5, alpha=degree2radian(i*15), col=ellipseCols[i])
  }
  ellipse(0, 0, a=1, b=1, col="black", lwd=2)
  ellipse(0, 0, a=0.5, b=0.5, fill="steelblue")
}


bedapub/ribiosPlot documentation built on Sept. 1, 2023, 6:50 p.m.