Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

filledellipse

adds a colored and rotated ellipse to a plot


Description

plots (part of) outer and inner ellipses and colors inbetween; color can be a palette

Usage

filledellipse(rx1 = 1, rx2 = 0, ry1 = rx1, ry2 = NULL, mid = c(0,0), 
  dr = 0.01, angle = 0, from = -pi, to = pi, col = femmecol(100),  
  values = NULL, zlim = NULL, lwd = 2, lcol = NA, ...)

Arguments

rx1

horizontal radius of outer ellipse.

rx2

horizontal radius of inner ellipse.

ry1

vertical radius of outer ellipse.

ry2

vertical radius of inner 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. The segment is drawn counterclockwise. The default is draw a full ellipse.

col

color palette to be used; also allowed are two extremes or one value.

values

if not NULL, a matrix providing (radius,z-values) couples, used for coloring. .

zlim

Only if values is not NULL: the minimum and maximum z values for which colors should be plotted, defaulting to the range of the finite values of the second column of values.

lwd

width of external line.

lcol

line color.

...

arguments passed to R-function polygon.

Details

draws (part of) an outer and inner ellipse, as specified by inner and outer radiusses:

rx1,ry1: horizontal and vertical radiusses of outer ellipse; rx2,ry2: same for inner ellipse. Here "horizontal" and "vertical" denote the position BEFORE rotation

Fills with a palette of colors inbetween

values: if not NULL, a matrix providing (radius,z-values) couples, used for coloring. Here radius are positive values denoting the relative distance between the shapes centre and edge. The radiusses are rescaled to be in [0,1] if needed. z-values (2nd column of values) together with zlim and col denote the coloration level.

Colors in col will be interpolated to the z-values and used to color an interval as given by the input radiusses.

If rx2, the radius of the inner ellipse is 0, the ellipse is full.

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

See Also

Examples

color <- greycol(50)
dr    <- 0.05
emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), col = color[length(color)], 
          main = "filledellipse")
filledellipse(rx1 = 1, mid = c(1, 1) , dr = dr, 
              col = shadepalette(endcol = "darkblue")) 
filledellipse(rx1 = 1, ry1 = 0.5, mid = c(-1, -1), dr = dr, angle = 90, 
              col = shadepalette(endcol = "darkred"))
filledellipse(rx1 = 1, ry1 = 0.5, rx2 = 0.5, dr = dr, mid = c(0, 0), 
              col = c(rev(color), color))
filledellipse(rx1 = 0.5, mid = c(1, -1), dr = dr, from = pi,  to = 1.5*pi, 
              col = rev(shadepalette(endcol = "black"))) 
filledellipse(mid = c(-1, 1))  
  
emptyplot(xlim = c(-2, 2), ylim = c(-2, 2), main = "filledellipse")
filledellipse(rx1 = 0.75, mid = c(-1, 1), col = greycol(100) , dr = dr,  
              values = cbind (1:100, (1:100)^0.5))
filledellipse(rx1 = 0.75, mid = c(1, 1), col = greycol(100)  , dr = dr,  
              values = cbind (1:100, (1:100)))
filledellipse(rx1 = 0.75, mid = c(-1, -1), col = greycol(100), dr = dr,  
              values = cbind (1:100, (1:100)^2))
filledellipse(rx1 = 0.75, mid = c(1, -1), col = greycol(100) , dr = dr,  
              values = cbind (1:100, (1:100)^5))

shape

Functions for Plotting Graphical Shapes, Colors

v1.4.5
GPL (>= 3)
Authors
Karline Soetaert <karline.soetaert@nioz.nl>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.