Learn R Programming

ggdibbler (version 0.6.1)

position_nest: Any combination of nested positions

Description

This function lets you nest any two positions available in ggplot2 (your results may vary). This allows you to set different position adjustments for the "main" and "distribution" parts of your plot.

Usage

position_nest(position = "identity_identity")

Value

A ggplot2 position

Arguments

position

a character of the nested position you want to use

Examples

Run this code
# nested positions allows us to differentiate which postion adjustments
# are used for the plot groups vs the distribution samples
library(ggplot2)
ggplot(uncertain_mpg, aes(class)) + 
  geom_bar_sample(aes(fill = drv), alpha=0.9,
                  position = position_nest("stack_dodge"))

Run the code above in your browser using DataLab