Need help with ggmosaic?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

haleyjeppson
143 Stars 15 Forks 359 Commits 14 Opened issues

Description

Mosaicplots in the ggplot2 framework

Services available

!
?

Need anything else?

Contributors list

# 477,219
R
HTML
Shell
170 commits
# 427,186
R
139 commits
# 170,205
R
JavaScr...
Shell
forecas...
6 commits
# 277,492
Markdow...
R
Shell
GitHub
4 commits
# 9,810
R
r-packa...
seleniu...
Bootstr...
3 commits
# 198,428
R
Shell
TeX
travis-...
1 commit

CRAN
Status CRAN RStudio mirror
downloads Travis-CI Build
Status

ggmosaic

ggmosaic was designed to create visualizations of categorical data and is capable of producing bar charts, stacked bar charts, mosaic plots, and double decker plots.

Installation

You can install ggmosaic from github with:

# install.packages("devtools")
devtools::install_github("haleyjeppson/ggmosaic")

Example

library(ggmosaic)
#> Loading required package: ggplot2
ggplot(data = fly) +
  geom_mosaic(aes(x = product(rude_to_recline), fill=do_you_recline)) +
  theme_mosaic()

<!-- -->

geom_mosaic: setting the aesthetics

In

geom_mosaic()
, the following aesthetics can be specified:
  • weight
    : select a weighting variable
  • x
    : select variables to add to formula
    • declared as
      x = product(var2, var1, ...)
  • alpha
    : add an alpha transparency to the selected variable
    • unless the variable is called in
      x
      , it will be added to the formula in the first position
  • fill
    : select a variable to be filled
    • unless the variable is called in
      x
      , it will be added to the formula in the first position after the optional
      alpha
      variable.
  • conds
    : select a variable to condition on
    • declared as
      conds = product(cond1, cond2, ...)

These values are then sent through repurposed

productplots
functions to create the desired formula:
weight ~ alpha + fill + x | conds
.

Version compatibility issues with ggplot2

Since the initial release of ggmosaic, ggplot2 has evolved considerably. And as ggplot2 continues to evolve, ggmosaic must continue to evolve alongside it. Although these changes affect the underlying code and not the general usage of ggmosaic, the general user may need to be aware of compatibility issues that can arise between versions. The table below summarizes the compatibility between versions.

| ggmosaic | ggplot2 | Axis labels | Tick marks | |----------|---------|-----------------------------------------------------------------------------|---------------| | 0.3.3 | 3.3.3 | x | x | | 0.3.0 | 3.3.0 | x | x | | 0.2.2 | 3.3.0 | Default labels are okay, but must use

scale_*_productlist()
to modify | No tick marks | | 0.2.2 | 3.2.0 | Default labels okay, but must use
scale_*_productlist()
to modify | x | | 0.2.0 | 3.2.0 | Default labels are wrong, but can use
labs()
to modify | x |

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.