stackedpoly: Stacked polygon plot

Description Usage Arguments See Also Examples

View source: R/stackedpoly.R

Description

Plot a data data frame with one independent and several dependend variables as stacked polygons.

Usage

1
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 which are plotted

density

vector with densities of shading lines, in lines per inch. The default value of NA means that no shading lines are drawn and so allow color filling.

angle

vector with slopes of shading lines, given as an angle in degrees (counter-clockwise).

border

the color to draw the border. The default, NA, means to omit borders.

col

the color for filling the polygon. The default, NA, is to leave polygons unfilled, unless density is specified.

xlab

a title for the x axis: see title.

ylab

a title for the y axis: see title.

...

other graphical parameters passed to plot resp. 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
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")
  

rsachse/limnotools documentation built on Jan. 8, 2021, 5:37 a.m.