proportional_shade: Proportional shaded data

View source: R/proportional-shade.R

proportional_shadeR Documentation

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"
)

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".

Value

A data frame of the proportional shaded diagram.

Examples

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)


animbook documentation built on June 22, 2024, 7:14 p.m.