position_stack_: Stack overlapping objects on top of each another

View source: R/position-stack-.R

position_stack_R Documentation

Stack overlapping objects on top of each another

Description

position_stack_ stacks bars on top of each other, conditional on locations.

Usage

position_stack_(vjust = 1, reverse = FALSE)

position_fill_(vjust = 1, reverse = FALSE)

Arguments

vjust

Vertical adjustment for geoms that have a position (like points or lines), not a dimension (like bars or areas). Set to 0 to align with the bottom, 0.5 for the middle, and 1 (the default) for the top.

reverse

If TRUE, will reverse the default stacking order. This is useful if you're rotating both the plot and legend.

Details

It is built based on position_stack, but used for multiple locations, such as geom_hist_ or geom_density_. Rather than stack everything on top of each other, position_stack_ stacks bars based on locations. Check examples to see the difference.

See Also

See geom_hist_, geom_density_, geom_serialaxes_density and geom_serialaxes_hist for more examples.

Other position adjustments for multiple locations: position_identity_, position_dodge_, position_dodge2_

Parent: position_stack

Examples

p <- ggplot(iris,
       mapping = aes(Sepal.Length = Sepal.Length,
                     Sepal.Width = Sepal.Width,
                     Petal.Length = Petal.Length,
                     Petal.Width = Petal.Width,
                     colour = Species))
p +
 geom_serialaxes_density(position = position_stack_())


p +
  geom_serialaxes_density(position = position_stack())



z267xu/ggmulti documentation built on April 12, 2024, 1:31 p.m.