Learn R Programming

shape (version 1.3.1)

filledmultigonal: adds a colored and rotated multigonal shape to a plot

Description

draws and colors a rotated shape with equal-sized vertices ; color can be a palette.

Usage

filledmultigonal(mid = c(0, 0), rx = 1, ry = rx, nr = 4, 
                 col = femmecol(100), values = NULL, 
                 zlim = NULL, lwd = 2, lcol = NA, angle = 0, ...)

Arguments

mid
midpoint of multigonal.
rx
horizontal radius.
ry
vertical radius.
nr
number of sides.
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.
angle
angle of rotation, in degrees.
...
arguments passed to R-function polygon.

Details

Coloration proceeds from midpoint to external edge rx,ry: horizontal and vertical radiusses of the shape. Here "horizontal" and "vertical" denote the position BEFORE rotation

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.

See Also

filledrectangle, filledshape, filledcylinder, filledellipse

Examples

Run this code
emptyplot(c(-1, 1), main = "filledmultigonal")

filledmultigonal(rx = 0.25, ry = 0.125, nr = 3, mid = c(-0.75, 0.75), 
            angle = 45, col = shadepalette("red", "blue", n = 50))
filledmultigonal(rx = 0.125, ry = 0.25, nr = 3, mid = c(-0.25, 0.75), 
            col = shadepalette("red", "yellow", n = 50))
filledmultigonal(rx = 0.25, ry = 0.25 , nr = 3, mid = c(0.25, 0.75),  
            col = c("red", "orange"))
filledmultigonal(rx = 0.25, ry = 0.25 , nr = 3, mid = c(0.75, 0.75), 
            angle = 90,  col = "red")
 
filledmultigonal(rx = 0.25, ry = 0.25, nr = 4, mid = c(-0.75, 0.25), 
            angle = 0, col = shadepalette("red", "blue", n = 50))
filledmultigonal(rx = 0.25, ry = 0.25, nr = 4, mid = c(-0.25, 0.25),  
            angle = 45, col = shadepalette("red", "blue", n = 50))
filledmultigonal(rx = 0.25, ry = 0.125, nr = 4, mid = c(0.25, 0.25), 
            angle = 0, col = shadepalette("red", "blue", n = 50))
filledmultigonal(rx = 0.25, ry = 0.125, nr = 4, mid = c(0.75, 0.25), 
            angle = 45, col = shadepalette("red", "blue", n = 50))
  
filledmultigonal(rx = 0.25, ry = 0.25, nr = 5, mid = c(-0.75, -0.25),  
            angle = 0, col = shadepalette("darkgreen", "lightgreen", n = 50))
filledmultigonal(rx = 0.25, angle = 0, nr = 5, mid = c(-0.25, -0.25), 
            col = rainbow(50))
filledmultigonal(rx = 0.25, angle = 30, nr = 6, mid = c(0.25, -0.25), 
            col = femmecol(50))
filledmultigonal(rx = 0.25, ry = 0.125, angle = 30, nr = 6, mid = c(0.75, -0.25), 
            col = "black")
  
filledmultigonal(rx = 0.25, col = "darkblue", nr = 7, mid = c(-0.75, -0.75))
filledmultigonal(rx = 0.25, col = "darkblue", nr = 9, mid = c(-0.25, -0.75))
filledmultigonal(rx = 0.25, col = "darkblue", nr = 3.7, mid = c(0.25, -0.75))
filledmultigonal(rx = 0.25, col = "darkblue", nr = 4.5, mid = c(0.75, -0.75))

Run the code above in your browser using DataLab