marimekko | R Documentation |
Creates Marimekko diagram from data.frame.
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") )
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. |
Utilizes a script similar to https://observablehq.com/@d3/marimekko-chart adapted to work with r2d3.
A d3 object as returned by r2d3.
data(sales) marimekko(sales, x.column = "market", y.column = "segment")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.