https://github.com/asjadnaqvi/stata-marimekko
A Stata package for Marimekko graphs
https://github.com/asjadnaqvi/stata-marimekko
ado graph marimekko mosaic package stata
Last synced: 7 months ago
JSON representation
A Stata package for Marimekko graphs
- Host: GitHub
- URL: https://github.com/asjadnaqvi/stata-marimekko
- Owner: asjadnaqvi
- License: mit
- Created: 2022-06-28T19:56:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-08T09:31:55.000Z (9 months ago)
- Last Synced: 2025-03-10T06:34:46.223Z (7 months ago)
- Topics: ado, graph, marimekko, mosaic, package, stata
- Language: Stata
- Homepage:
- Size: 1.36 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
     
[Installation](#Installation) | [Syntax](#Syntax) | [Examples](#Examples) | [Feedback](#Feedback) | [Change log](#Change-log)
---

# marimekko v1.2
(11 Nov 2024)This package provides the ability to draw Marimekko graphs in Stata.
## Installation
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.2**):
```
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"
```## Syntax
The syntax for the latest version is as follows:
```stata
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.
## Examples
```
sysuse voter.dta, clear
``````stata
marimekko pfrac pop, by(inc)
```
```stata
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)
```
## Feedback
Please open an [issue](https://github.com/asjadnaqvi/stata-marimekko/issues) to report errors, feature enhancements, and/or other requests.
## Change log
**v1.2 (11 Nov 2024)**
Complete package redesign with the following major changes:
- Minimum syntax is now `marimekko y x, by()`, where `by()` defines the x-axis categories.
- Y-axis categories are defined by `over()` variable.
- Both axes can be scaled using `xshare`, `xpercent` and `yshare`, `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, and `labcond()` to conditionally drop labels.
- The option `showtotal` shows x-axis `by()` 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.