stata-trimap

A Stata package for tri-variate maps

https://github.com/asjadnaqvi/stata-trimap

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.4%) to scientific vocabulary

Keywords

ado package stata ternary trimap trivariate
Last synced: 6 months ago · JSON representation

Repository

A Stata package for tri-variate maps

Basic Info
  • Host: GitHub
  • Owner: asjadnaqvi
  • License: mit
  • Language: Stata
  • Default Branch: main
  • Homepage:
  • Size: 29 MB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 2
  • Releases: 2
Topics
ado package stata ternary trimap trivariate
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

StataMin issues license Stars version release

Installation | Syntax | Examples | Feedback | Change log


trimap_banner


trimap v1.1

(12 Sep 2024)

This package provides the ability to draw trimaps Stata.

Installation

The package can be installed via SSC or GitHub. 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.

The SSC version (v1.0):

stata ssc install trimap, replace

Or it can be installed from GitHub (v1.1):

stata net install trimap, from("https://raw.githubusercontent.com/asjadnaqvi/stata-trimap/main/installation/") replace

The following packages are required to run this command:

stata ssc install geoplot, replace ssc install ternary, replace ssc install palettes, replace ssc install colrspace, replace ssc install moremata, replace

Even if you have the package installed, make sure that it is updated ado update, update.

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:

stata ssc install schemepack, replace set scheme white_tableau

You can also push the scheme directly into the graph using the scheme(schemename) option. See the help file for details or the example below.

I also prefer narrow fonts in figures with long labels. You can change this as follows:

stata graph set window fontface "Arial Narrow"

Syntax

The syntax for the latest version is as follows:

stata trimap varL varR varB [if] [in], [ frame(frame name) cuts(num) normalize(1|100) geo(layers) geopost(options) zoom fill points lines labels colorL(str) colorR(str) colorB(str) lwidth(str) msize(str) malpha(num) mcolor(str) mlcolor(str) mlwidth(str) leglwidth(str) leglcolor(str) mlabel(var) mlabsize(str) mlabcolor(str) mlabposition(str) xscale(num) yscale(num) * ]

See the help file help trimap for details.

The most basic use is as follows:

trimap varL varR varB, frame(framename)

representing left, right and bottom variables respectively. The framename is the frame in which the data is stored.

Citation guidelines

Software packages take countless hours of programming, testing, and bug fixing. If you use this package, then a citation would be highly appreciated. Suggested citations:

in BibTeX

@software{trimap, author = {Naqvi, Asjad}, title = {Stata package ``trimap''}, url = {https://github.com/asjadnaqvi/stata-trimap}, version = {1.1}, date = {2024-09-12} }

or simple text

Naqvi, A. (2024). Stata package "trimap" version 1.1. Release date 12 September 2024. https://github.com/asjadnaqvi/stata-trimap.

or see SSC citation (updated once a new version is submitted)

Examples

Data setup

Get the shapefiles

stata foreach x in NUTS0 NUTS0_shp NUTS1 NUTS1_shp NUTS2 NUTS2_shp NUTS3 NUTS3_shp { copy "https://github.com/asjadnaqvi/stata-trimap/raw/main/data/`x'.dta" "`x'.dta", replace }

Get the data files

stata foreach x in NUTS3_pop NUTS3_gva NUTS2_edu NUTS2_tourstay { copy "https://github.com/asjadnaqvi/stata-trimap/raw/main/data/`x'.dta" "`x'.dta", replace }

Set up the data:

stata geoframe create nuts0, replace geoframe create nuts1, replace geoframe create nuts2, replace geoframe create nuts3, replace

``` frames change nuts3

merge 1:1 NUTSID using NUTS3pop drop if _m==2 drop _m

format *prop %5.0f ```

Test if geoplot is working correctly:

```stata geoplot /// (area nuts3 y15prop, cuts(0(10)100) ) /// (line nuts0, lc(white) lw(0.2)) /// , tight title("Population share 15-64")

geoplot /// (area nuts3 y64prop, cuts(0(10)100) ) /// (line nuts0, lc(white) lw(0.2)) /// , tight title("Population share 0-14")

geoplot /// (area nuts3 y99prop, cuts(0(10)100) ) /// (line nuts0, lc(white) lw(0.2)) /// , tight title("Population share 65+")
```

which gives us:

stata ternary y99prop y15prop y64prop, points

Test the command

stata trimap y99prop y15prop y64prop, frame(nuts3) mlc(white)

stata trimap y99prop y15prop y64prop, frame(nuts3) mlc(white) /// geo( (line nuts0, lc(white) lw(0.05)) )

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom mlc(white) cuts(4) /// geo( (line nuts0, lc(white) lw(0.05)) ) norm(1)

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom mlc(white) cuts(4) /// geo( (line nuts0, lc(white) lw(0.05)) )

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) mlc(white) /// geo((line nuts0, lc(white) lw(0.05)))

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msym(point)

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msize(0.5) mcolor(white%50) leglc(black) mlc(white)

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(2) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msize(0.5) mcolor(white%60) leglc(black) mlc(white)

stata trimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msize(0.5) mcolor(white%60) leglc(black) colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) mlc(white)

Try another layer

stata merge 1:1 NUTS_ID using NUTS3_gva drop if _m==2 drop _m

stata trimap gva_tertiary gva_primary gva_secondary, frame(nuts3) cuts(4) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) msize(0.3) mcolor(black%60) mlc(none)

stata trimap gva_secondary gva_tertiary gva_primary , frame(nuts3) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) msize(0.3) mcolor(black%60) mlc(none)

stata trimap gva_secondary gva_tertiary gva_primary , frame(nuts3) cuts(8) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) msize(0.3) mcolor(black%60) mlc(none)

And other layers at the NUTS2 level

```stata frame change nuts2

merge 1:1 NUTSID using NUTS2edu drop if _m==2 drop _m

trimap eduprimary edusecondary edu_tertiary, frame(nuts2) cuts(2) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msize(0.4) mcolor(black%60) mlc(none) ```

trimap edu_primary edu_secondary edu_tertiary, frame(nuts2) zoom cuts(2) /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msize(0.4) mcolor(black%60) mlc(none)

```stata merge 1:1 NUTSID using NUTS2tourstay.dta drop if _m==2 drop _m

trimap tourhotels tourother tour_camping , frame(nuts2) cuts(4) zoom /// geo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) ) /// fill msize(0.4) mcolor(black%60) mlc(none) ```

Feedback

Please open an issue to report errors, feature enhancements, and/or other requests.

Change log

v1.1 (12 Sep 2024) - Package aligned with ternary by adding options norm(), mlabel(), mlabcolor(), mlabposition(), mlabsize(). - Better zoom. - Minor cleanups.

v1.0 (28 Aug 2024) - First release.

Owner

  • Name: Asjad Naqvi
  • Login: asjadnaqvi
  • Kind: user
  • Location: Vienna
  • Company: WIFO

Vienna, Austria

GitHub Events

Total
  • Issues event: 2
  • Watch event: 2
  • Issue comment event: 8
Last Year
  • Issues event: 2
  • Watch event: 2
  • Issue comment event: 8

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 2
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 4.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 4.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • JesusLucindo (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels