ggmm: Create a Marimekko/Mosaic plot with ggplot2

Description Usage Arguments Details Value Examples

View source: R/ggmm.R

Description

Take two categorical variables and create a Marimekko/Mosaic plot from it.

Usage

1
2
ggmm(df, x, y, alpha_condition = 1 == 1, add_text = c(NULL, "n", "prop",
  "perc"), round_text = 2)

Arguments

df

Data frame containing x and y.

x

Bare name of the variable for the x-axis.

y

Bare name of the variable for the y-axis and the fill.

alpha_condition

All cells meeting this condition will have the alpha set to 1. Cells not meeting the condition have the alpha set to 0.4.

add_text

Add cell count, cell proportion of total, or cell percentage of total.

round_text

Nr of decimals, only applies to proportions and percentages.

Details

The alpha_condition enables to highlight specific parts of the plot. This is especially helpful for highlighting marginal distributions.

Value

An object of class ggplot2.

Examples

1
2
3
ggmm(mtcars, cyl, vs)
ggmm(mtcars, cyl, vs, alpha_condition = vs == 1)
ggmm(mtcars, cyl, vs, alpha_condition = cyl == 6)

EdwinTh/thatssorandom documentation built on Jan. 18, 2020, 2:55 p.m.