Learn R Programming

animbook (version 1.0.0)

proportional_shade: Proportional shaded data

Description

This function creates a proportional shaded data using the specified parameters.

Usage

proportional_shade(
  initial = NULL,
  proportion = NULL,
  y = NULL,
  position = "left"
)

Value

A data frame of the proportional shaded diagram.

Arguments

initial

A numerical of initial values for the proportional shade.

proportion

A vector of proportions corresponding to each group.

y

A numeric vector specifying the vertical position of the shade diagram.

position

A character string specifying the side of the shade diagram. This needs to be either "left" (default) or "right".

Examples

Run this code
data <- proportional_shade(4, c(0.4, 0.3, 0.2, 0.1), c(4, 3, 2, 1))

ggplot2::ggplot(data = data, ggplot2::aes(x = x, y = y, group = id, fill = as.factor(id))) +
  ggplot2::geom_polygon(alpha = 0.1)

Run the code above in your browser using DataLab