powered by
This function creates a proportional shaded data using the specified parameters.
proportional_shade( initial = NULL, proportion = NULL, y = NULL, position = "left" )
A data frame of the proportional shaded diagram.
A numerical of initial values for the proportional shade.
A vector of proportions corresponding to each group.
A numeric vector specifying the vertical position of the shade diagram.
A character string specifying the side of the shade diagram. This needs to be either "left" (default) or "right".
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