Skip to contents

Mosaic layers

The main geoms and stats for building mosaic plots, plus the plot-scoped settings and faceting support that let them share a model or layout across layers/panels

geom_mosaic() stat_mosaic_text() stat_mosaic()
Mosaic plots.
geom_mosaic_jitter() stat_mosaic_jitter()
Jittered dots in Mosaic plots.
geom_mosaic_text()
Labeling for Mosaic plots.
mosaic_settings()
Settings for mosaic plot layers
facet_mosaic_grid()
Facet mosaic plots with panel-specific axes

Scales

Scales for the product-formula axes and residual-shaded fill

product()
Wrapper for a list
scale_x_productlist() scale_y_productlist() ScaleContinuousProduct
Determining scales for mosaics
scale_type(<productlist>)
Helper function for determining scales
scale_fill_residual() scale_fill_residuals()
Diverging color scale for Pearson residuals

Theme

theme_mosaic()
Theme for mosaic plots

Loglinear models

Fitting the models behind residual/expected-value shading

fit_loglinear_model()
Fit Poisson GLM and calculate Pearson residuals
build_model_formula()
Build model formula from user specification
shortcut_to_formula()
Translate shortcut strings to formulas

Partitioning & layout

Divider functions that control how a mosaic recursively splits into rectangles, and the lower-level layout calculations behind them

mosaic()
Template for a mosaic plot. A mosaic plot is composed of spines in alternating directions.
hbar()
Horizontal bar partition: width constant, height varies.
hspine()
Horizontal spine partition: height constant, width varies.
vbar()
Vertical bar partition: height constant, width varies.
vspine()
Vertical spine partition: width constant, height varies.
spine()
Spine partition: divide longest dimension.
squeeze()
Internal helper function
prodcalc()
Calculate frequencies.

ggproto objects

Underlying Geom/Stat classes, for extending the package (the ScaleContinuousProduct class is documented alongside scale_x_productlist() above)

GeomMosaic
Geom proto
GeomMosaicJitter
Geom proto
GeomMosaicText
Geom proto
StatMosaic
Geom proto
StatMosaicJitter
Geom proto
StatMosaicText
Geom proto

Templates & apps

ggmosaic_app() is deprecated, inherited as-is from ggmosaic for the historical record only

ddecker()
Template for a double decker plot. A double decker plot is composed of a sequence of spines in the same direction, with the final spine in the opposite direction.
ggmosaic_app()
Launch shiny app (deprecated)

Data

happy
Data related to happiness from the general social survey.
fly
Flying Etiquette Survey Data
titanic
Passengers and crew on board the Titanic

Package

ggmosaic2 ggmosaic2-package
ggmosaic2: Mosaic Plots in the 'ggplot2' Framework, Extended