marimekko: Marimekko diagram

View source: R/marimekko.R

marimekkoR Documentation

Marimekko diagram

Description

Creates Marimekko diagram from data.frame.

Usage

marimekko(
  df,
  x.column = "x",
  y.column = "y",
  value.column = "value",
  min.opacity = 0.25,
  max.opacity = 0.9,
  color.scheme = c("Spectral", names(d3po::color.schemes)),
  width = NULL,
  height = NULL,
  viewer = c("internal", "external", "browser")
)

Arguments

df

data.frame containing horizontal category, vertical category, and value data.

x.column

Name of column containing horizontal category data. Defaults to "x".

y.column

Name of column containing vertical category data. Defaults to "y".

value.column

Name of column containing value data. Defaults to "value".

min.opacity

Minimum opacity value for area colors, between 0 and 1. Defaults to 0.25.

max.opacity

Maximum opacity value for area colors, between 0 and 1. Defaults to 0.9.

color.scheme

Color scheme to use in visualization. See color.schemes for more details.

width

Desired width for output widget.

height

Desired height for output widget.

viewer

"internal" to use the RStudio internal viewer pane for output; "external" to display in an external RStudio window; "browser" to display in an external browser.

Details

Utilizes a script similar to https://observablehq.com/@d3/marimekko-chart adapted to work with r2d3.

Value

A d3 object as returned by r2d3.

Examples

data(sales)

marimekko(sales, x.column = "market", y.column = "segment")


tkmckenzie/d3po documentation built on June 2, 2022, 2:41 p.m.