help alluvialalluvial v1.21 (GitHub)

alluvial

: A Stata package for Alluvial plots.

Syntax

alluvial varlist [if] [in] [weight],
[
palette(str) colorby(layer|level) smooth(1-8) gap(num) recenter(mid|bot|top)
labangle(str) labsize(str) labposition(str) labgap(str) showtotal
valsize(str) valcondition(num) valformat(str) valgap(str) novalues
lwidth(str) lcolor(str) alpha(num) offset(num) boxwidth(str)
title(str) subtitle(str) note(str) scheme(str) name(str) xsize(num) ysize(num)
]

Please note that alluvial is still in beta and not all checks and balances have been added.
Please report errors/bugs/enhancement requests on GitHub

alluvial varlist The command requires a set of categorical variables. The command tabulates the combinations based on the number of rows for each category.
If a variable has more than 20 categories, the program will throw and error and exit. Weights are allowed but use them cautiously.
They still needed to be fully tested.

palette(name) Color name is any named scheme defined in the colorpalette package. Default is tableau.

colorby(option) Users can color the diagram by layer or level. The layer option, determined by the by() variable, will give
each layer a unique color. The level option will give each category a unique color, even if they exist across multiple layers.
The default value is colorby(level).

shares Convert the values into shares. If weights are used, these will be weighted shares.

showmiss Add a missing values category on the graph. The shares of existing categories plus the missing category for each layer add up to one.

smooth(num) This option allows users to smooth out the spider plots connections. It can take on values between [1,8], where 1 is for straight lines, and 8 is stepwise.
The middle range between 3-6 gives more curvy links. The default value is smooth(4).

gap(num) Gap between categories is defined as a percentage of the highest y-axis range across the layers. Default value is gap(2) for 2%.

recenter(option) Users can recenter the graph middle (mid or m also accepted), top (or t), or bottom (or bot or b).
This is mostly an aesthetic choice. Default value is recen(mid).

alpha(num) The transparency control of the area fills. The value ranges from 0-100, where 0 is no fill and 100 is fully filled.
Default value is alpha(75) for 75% transparency.

boxwidth(str) The width of the boxes. Default is .

lwidth(str) The outline width of the area fills. Default is lw(none). This implies that they are turned off by default.

lcolor(str) The outline color of the area fills. Default is lc(white).

labsize(str) The size of the category labels. Default is labs(2).

labangle(str) The angle of the category labels. Default is laba(90) for vertical labels.

labposition(str) The position of the category labels. Default is labpos(0) for centered.

offset(num) The value, in percentage of x-axis width, to extend the x-axis on the right-hand side. Default is offset(0).
This option is highly useful if labels are rotated horizontally, and for example, positioned at 3 o'clock.

labgap(str) The gap of the category labels from the mid point of the wedges. Default is labg(0) for no gap.
If the label angle is change to horitzontal or the label position is changed from 0, then labg() can be used to fine-tune the placement.

showtotal Display the category totals.

valsize(str) The size of the displayed values. Default is vals(1.5).

valcondition(num) The condition for showing value labels. For example, if we only want to display categories with a greater than a value of 100,
we can specify valcond(100). If the share is used, then please specify the share threshold (out of 100). Default is valcond(0).

valformat(str) The format of the displayed values. Default is valf(%12.0f).

novalues Hide the values.

title(), subtitle(), note() These are standard twoway graph options.

scheme(), name() These are standard twoway graph options.

xsize(), ysize() These standard twoway options can be used to space out the layers.
This is particularly helpful if several layers are plotted.

Dependencies

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

ssc install palettes, replace
ssc install colrspace, replace

Even if you have these installed, it is highly recommended to update the dependencies:
ado update, update

Examples

See GitHub for examples.

Package details

Version : alluvial v1.21
This release : 19 Oct 2023
First release: 10 Dec 2022
Repository : GitHub
Keywords : Stata, graph, alluvial
License : MIT

Author : Asjad Naqvi
E-mail : asjadnaqvi@gmail.com
Twitter : @AsjadNaqvi

Feedback

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

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, circlebar, circlepack, clipgeo, delaunay, joyplot,
marimekko, sankey, schemepack, spider, streamplot, sunburst, treecluster, treemap