Installation | Syntax | Examples | Feedback | Change log
(11 Nov 2024)
This package provides the ability to draw Marimekko graphs in Stata.
The package can be installed via SSC or GitHub (the beta is on GitHub only). The GitHub version, might be more recent due to bug fixes, feature updates etc, and may contain syntax improvements and changes in default values. See version numbers below. Eventually the GitHub version is published on SSC.
Install the package as follows:
SSC (v1.1):
ssc install marimekko, replace
or directly from GitHub (v1.2):
net install marimekko, from("https://raw.githubusercontent.com/asjadnaqvi/stata-marimekko/main/installation/") replace
If you want to make a clean figure, then it is advisable to load a clean scheme. These are several available and I personally use the following:
ssc install schemepack, replace
set scheme white_tableau
I also prefer narrow fonts in figures with long labels. You can change this as follows:
graph set window fontface "Arial Narrow"
The syntax for the latest version is as follows:
marikmekko y x [if] [in] [weight], by(varname)
[ over(varname) sort(varname) reverse palette(str) xshare xpercentage yshare ypercentage wrap(num) stat(mean|sum)
lcolor(str) lwidth(str) labsize(str) labangle(str) labgap(str) labposition(str) labcolor(num) showtotal
labcondition(num) labprop labscale(num) legposition(num) legrows(num) legsize(num) offset(num) * ]
See the help file help marimekko
for details.
sysuse voter.dta, clear
marimekko pfrac pop, by(inc)
marimekko pfrac pop, by(inc) sort(inc)
marimekko pfrac pop, by(inc) over(candidat)
marimekko pfrac pop, by(inc) over(candidat) showtotal
marimekko pfrac pop, by(inc) over(candidat) showtotal labprop labsize(3)
marimekko pfrac pop, by(inc) over(candidat) showtotal yshare
marimekko pfrac pop, by(inc) over(candidat) showtotal ypercent
marimekko pfrac pop, by(inc) over(candidat) showtotal ypercent xpercent
marimekko pfrac pop, by(inc) over(candidat) sort(inc) showtotal ypercent xpercent
marimekko pfrac pop, by(inc) over(candidat) sort(inc) showtotal ypercent xpercent palette(sb colorblind6) lw(0.2) legsize(4)
Please open an issue to report errors, feature enhancements, and/or other requests.
v1.2 (11 Nov 2024)
Complete package redesign with the following major changes:
- Minimum syntax is now
marimekko y x, by()
, whereby()
defines the x-axis categories. - Y-axis categories are defined by
over()
variable. - Both axes can be scaled using
xshare
,xpercent
andyshare
,ypercent
options. These are for (0,1) or (0,100) scaling. - All possible options added to control the labels. This also includes
labprop
and its controls, andlabcond()
to conditionally drop labels. - The option
showtotal
shows x-axisby()
category totals with the labels. - Option
wrap()
allows label wrapping. - Weights are allowed.
- Redesign of the underlying functions to generate boxes makes the command much faster than the previous versions.
legend()
options are restricted to a limited set of predefined options which should be sufficient for most cases. These can be overwritten but avoid this.- Previous version had options to also show negative boxes. Currently these haven't been fully implemented and tested for this version.
v1.1 (02 Dec 2023)
- Additional options, such as
yline()
,xline()
added. - Code cleanup.
v1.0 (28 Jun 2022)
- Beta version.