help wafflewaffle v1.23 (GitHub)

waffle

: A Stata package for Waffle plots.

The command is based on the Waffle plots guide on Medium.

Syntax

waffle numvar(s) [if] [in],
[ by(variable) over(variable) normvar(variable) percent showpct format(fmt) palette(name)
rowdots(num) coldots(num) aspect(num) msymbol(list) msize(list) mlwidth(list)
ndsymbol(str) ndsize(str) ndcolor(str) cols(num) margin(str) novalues wrap(num)
legcolumns(num) legposition(pos) legsize(str) note(str) subtitle(str) * ]

Wide form:

waffle numvars Use this option if the data is in wide form and each category is stored in a separate variable. Here one can specify
a list of variables. Drawing is currently in alphabetical order.

Long form:

waffle numvar, by(var) Use this option if the data is in long form and a single numvar can be split using the by() variable.

over(var) Further splits the waffle into over() groups where each is assigned a different color.

normvar(var) Normalize the heights based on the normvar() variable. Otherwise the category with the highest value will be shown as fully covering
all the dots in the waffle. The gaps to the full height as shown as no data (nd) symbols. See options below. It is highly recommended to calculate the normvar()
beforehand. For wide form the sum of normvar() values are taken since each row is assumed to be a subset, for long form the mean of normvar() is taken.
This option might still evolve to better fit user cases.

percent This will normalize each category to 100% split into own over() categories.

showpct Show percentage share instead of actual totals in the waffle plot.

novalues Hide the total or percentage values in front of labels.

format(fmt) Format the values displayed. Defaults are format(%15.0fc) and format(%6.2f) if the showpct option is specified.

wrap(num) Wrap the labels after a number of characters. Word boundaries are respected.

palette(name) Color name is any named scheme defined in the colorpalette package. Default is tableau.
The over() option shows colors.

rowdots(num), coldots(num) These options can be used to control the number of dots in the waffle. Defaults are rowdots(20) and coldots(20).
Changing these will automatically trigger a change in the aspect ratio to ensure that dot spacing is even. If not, then overwrite the aspect() option.

aspect(num) Aspect ratio of the waffle plots. Default is coldots()/rowdots().

msymbol(list) Provide a list of acceptable marker symbols for each over() category. If the length of symbols is less than the over() layers,
then the last specified symbol is used for the remaining layers. Default is msymb(square), which is an obvious choice for a waffle plot.

msize(list) Provide a list of marker sizes for each over() category. Default is msize(0.9).

mlwidth(list) Provide a list of marker line widths for each over() category. Useful if hollow symbols are used, which look very
slim compared to filled symbols. Default is mlwid(0.05).

ndsymbol(str) Symbol of filler no data category. Default is ndsymb(square).

ndsize(str) Size of the no data category. Default is ndsize(0.5).

ndcolor(str) Color of the no data category. Default is ndc(gs14) if a the option is used, otherwise, it is turned off.

cols(num) Number of waffle columns. Default is cols(4).

margin(str) Margin of the waffle columns. Here one needs to specify valid margin options.

legcolumns(num) Number of legend columns. Default is legcol(4).

legposition(str) The position of the legend. Default is legpos(6).

legsize(str) The size of the legend labels. Default is legs(2.2).

note(str) Can be used for displaying more information about the by() variables. To turn it off use note("").

subtitle(str) Can be used customizing the labels of the waffle. Default is subtitle( , pos(6) size(2.5) nobox).

* All other twoway options not elsewhere specified.

Dependencies

The palette package (Jann 2018, 2022) is required for waffle:

ssc install palettes, replace
ssc install colrspace, replace

Even if you have these installed, it is highly recommended to check for updates: ado update, update

Examples

See GitHub.

Package details

Version : waffle v1.23
This release : 18 Oct 2024
First release: 01 Mar 2022
Repository : GitHub
Keywords : Stata, graph, waffle
License : MIT

Authors : Asjad Naqvi & Jared Colston
E-mail : asjadnaqvi@gmail.com, colston@wisc.edu
Twitter : @AsjadNaqvi

Feedback

Please submit bugs, errors, feature requests on GitHub by opening a new issue.

Citation guidelines

Suggested citation guidlines for this package:

Naqvi, A. and Colston, J. (2024). Stata package "waffle" version 1.23. Release date 18 October 2024. https://github.com/asjadnaqvi/stata-waffle.

@software

References

Jann, B. (2018). Color palettes for Stata graphics. The Stata Journal 18(4): 765-785.

Jann, B. (2022). Color palettes for Stata graphics: An update. University of Bern Social Sciences Working Papers No. 43.

Other visualization packages

arcplot, alluvial, bimap, bumparea, bumpline, circlebar, circlepack, clipgeo, delaunay, graphfunctions, joyplot,
marimekko, polarspike, sankey, schemepack, spider, splinefit, streamplot, sunburst, ternary, treecluster, treemap, trimap, waffle

or visit GitHub.