Last data update: 2014.03.03

R: Draw Elliptic or Circular Arc(s)
DrawArcR Documentation

Draw Elliptic or Circular Arc(s)

Description

Draw one or more elliptic or circular arcs from angle.beg to angle.end on an existing plot using classic graphics.

Usage

DrawArc(x = 0, y = x, radius.x = 1, radius.y = radius.x, 
        angle.beg = 0, angle.end = pi, nv = 100, 
        col = par("col"), lty = par("lty"), lwd = par("lwd"), 
        plot = TRUE)

Arguments

x, y

a vector (or scalar) of xy-coordinates of the center(s) of the arc(s).

radius.x

a scalar or a vector giving the semi-major axis of the ellipse for the arc(s)

radius.y

a scalar or a vector giving the semi-minor axis of the ellipse for the arc(s). Default is radius.x which will result in a circle arc with radius.x.

angle.beg

a scalar or a vector of starting angles in radians.

angle.end

a scalar or a vector of ending angles in radians.

nv

number of vertices used to plot the arc. Scalar or vector.

col

color for the arc(s). Scalar or vector.

lty

line type used for drawing.

lwd

line width used for drawing.

plot

logical. If TRUE the structure will be plotted. If FALSE only the xy-points are calculated and returned. Use this if you want to combine several geometric structures to a single polygon.

Details

All parameters are recycled if necessary.
Be sure to use an aspect ratio of 1 as shown in the example to avoid distortion.

Value

DrawArc invisibly returns a list of the calculated coordinates for all shapes.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

DrawCircle, DrawAnnulusSector, polygon

Examples

curve(sin(x), 0, pi, col="blue", asp=1)
DrawArc( x = pi/2, y = 0, radius.x = 1, angle.beg = pi/4, angle.end = 3*pi/4, col="red")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DescTools)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DescTools/DrawArc.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DrawArc
> ### Title: Draw Elliptic or Circular Arc(s)
> ### Aliases: DrawArc
> ### Keywords: aplot
> 
> ### ** Examples
> 
> curve(sin(x), 0, pi, col="blue", asp=1)
> DrawArc( x = pi/2, y = 0, radius.x = 1, angle.beg = pi/4, angle.end = 3*pi/4, col="red")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>