stackedpoly: Plot Stacked and Filled Polygons

Description Usage Arguments See Also Examples

Description

Plot time series as stacked polygons with color fill and/or shading.

Usage

1
2
stackedpoly(x, columns, density = NA, angle = 45, border = NA, col = NA,
  xlab = "x values", ylab = "y values", ...)

Arguments

x

object of class data.frame, the first column is used as x-axis.

columns

vector of column names in appropriate order that are plotted

density

the density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. A zero value of density means no shading nor filling whereas negative values and NA suppress shading (and so allow color filling).

angle

the slope of shading lines, given as an angle in degrees (counter-clockwise).

border

border of the polygon

col

the color for filling the polygon. The default, NA, is to leave polygons unfilled, unless density is specified. (For back-compatibility, NULL is equivalent to NA.) If density is specified with a positive value this gives the color of the shading lines.

xlab

label of the x axis

ylab

label of the y axis

...

further arguments passed to the polygon.

See Also

plot.default, polygon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## test data
set.seed(135)
dat <- data.frame(time = seq(7, 365, 14),
                  y1 = runif(26, min=1, max=10),
                  y2 = runif(26, min=0, max=15),
                  y3 = runif(26, min=0, max=2)
)


##' example palette
palette <-c("grey", "brown", "green", "yellow", "yellowgreen",
            "darkgreen", "blue", "black", "red", "grey", "red", "orange",
            "pink", "cyan"
)


## usage
stackedpoly(dat, c("y1", "y2", "y3"), col=palette)

## polygons with border
stackedpoly(dat, c("y1", "y2", "y3"), col=palette, border="black")

## optional plotting parameters
stackedpoly(dat, c("y1", "y2", "y3"), col=palette, ylim=c(0,50), main="Phytoplankton")

## changed order
stackedpoly(dat, c("y3", "y2", "y1"), col=palette, main="Phytoplankton")

## hatched area
stackedpoly(dat, c("y3", "y2", "y1"), density=c(20, 20, 40),
            angle=c(0, 90, 45), ylim=c(0,50), border=palette, main="Phytoplankton")

tpetzoldt/rodeoExt documentation built on May 31, 2019, 6:48 p.m.