Learn R Programming

ggdistribute (version 1.0.3)

position_spread: Spread Overlapping Grobs Spread overlapping groups by shrinking them to fit within the data's y range.

Description

Spread Overlapping Grobs Spread overlapping groups by shrinking them to fit within the data's y range.

Usage

position_spread(height = NULL, reverse = FALSE, padding = 0.2)

Arguments

height

One of total (default), panel, single, a numeric scalar value to give all geoms equal space, or a numeric vector the length of panels*groups for manually specifying the height of each group.

reverse

Reverse the order of segments within overlapping y ranges.

padding

Multiple of height. Will shrink/enlarge groups to fit within a region.

Examples

Run this code
# NOT RUN {
library(ggplot2)

x <- data.frame(y = rnorm(1000), x="", myGroup=sample(1:3, 1000, TRUE))

ggplot(x, aes(x, y))+
geom_point(aes(group=myGroup), position=position_spread(height = 0.5))
# }

Run the code above in your browser using DataLab