Draw ellipses in a flexible way.

ellipse(
  x = 0,
  y = x,
  mjradi = 1,
  mnradi = 0.5,
  from = 0,
  to = 2 * pi,
  rot = 0,
  incr = 0.01,
  pie = FALSE,
  ...
)

Arguments

x

the x coordinates of the centers of the ellipses.

y

same as x for the y-axis.

mjradi

the major radii of the ellipses.

mnradi

the minor radii of the ellipses.

from

the angles, expressed in radians, from which ellipses are drawn.

to

the angles, expressed in radians, to which ellipses are drawn.

rot

the rotation angles (in degree) of the ellipses.

incr

increments between two points to be linked (expressed in radians).

pie

a logical. If TRUE end points are linked with the center of the ellipse (default is set to FALSE).

...

additional arguments to be passed to graphics::polygon().

Details

For a rotation angle of 0, major radii refer to the one along the x axis.

The number of circles drawn is given by the maximum argument length among x, y, radi, from and to arguments. Sizes are adjusted using rep_len function.

To plot ellipses, polygon function is called.

Note

There is a similar function, called draw.ellipse, in the package plotrix.

Examples

#Example 1: plot0(asp=1)
ellipse()
#Example 2: plot0()
for (i in seq(0,360,30)) ellipse(rot=i)
#Example 3: plot0()
ellipse(matrix(-.5+.5*stats::runif(18), ncol=3))
#Example 4: plot0(x=c(-2,2),y=c(-2,2), asp=1)
ellipse(x=c(-1,1),c(1,1,-1,-1),from=pi*seq(0.25,1,by=0.25),to=1.25*pi, col=2, border=4, lwd=3)