{"id":26334450,"url":"https://github.com/asjadnaqvi/stata-trimap","last_synced_at":"2026-01-02T23:05:27.858Z","repository":{"id":256747196,"uuid":"848792054","full_name":"asjadnaqvi/stata-trimap","owner":"asjadnaqvi","description":"A Stata package for tri-variate maps","archived":false,"fork":false,"pushed_at":"2024-09-20T18:02:08.000Z","size":30451,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T06:34:46.666Z","etag":null,"topics":["ado","package","stata","ternary","trimap","trivariate"],"latest_commit_sha":null,"homepage":"","language":"Stata","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asjadnaqvi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-28T12:18:03.000Z","updated_at":"2024-11-13T06:51:14.000Z","dependencies_parsed_at":"2024-09-13T22:33:55.137Z","dependency_job_id":null,"html_url":"https://github.com/asjadnaqvi/stata-trimap","commit_stats":null,"previous_names":["asjadnaqvi/stata-trimap"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-trimap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-trimap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-trimap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-trimap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asjadnaqvi","download_url":"https://codeload.github.com/asjadnaqvi/stata-trimap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806666,"owners_count":20350888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ado","package","stata","ternary","trimap","trivariate"],"created_at":"2025-03-16T00:19:01.721Z","updated_at":"2026-01-02T23:05:27.852Z","avatar_url":"https://github.com/asjadnaqvi.png","language":"Stata","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![StataMin](https://img.shields.io/badge/stata-2015-blue) ![issues](https://img.shields.io/github/issues/asjadnaqvi/stata-trimap) ![license](https://img.shields.io/github/license/asjadnaqvi/stata-trimap) ![Stars](https://img.shields.io/github/stars/asjadnaqvi/stata-trimap) ![version](https://img.shields.io/github/v/release/asjadnaqvi/stata-trimap) ![release](https://img.shields.io/github/release-date/asjadnaqvi/stata-trimap)\n\n\n[Installation](#Installation) | [Syntax](#Syntax) | [Examples](#Examples) | [Feedback](#Feedback) | [Change log](#Change-log)\n\n---\n\n![trimap_banner](https://github.com/user-attachments/assets/a06e7bc6-3e2e-4356-adf1-48aadd511d3a)\n\n---\n\n# trimap v1.1\n(12 Sep 2024)\n\nThis package provides the ability to draw trimaps Stata.\n\n\n## Installation\n\nThe 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.\n\nThe SSC version (**v1.0**):\n\n```stata\nssc install trimap, replace\n```\n\nOr it can be installed from GitHub (**v1.1**):\n\n```stata\nnet install trimap, from(\"https://raw.githubusercontent.com/asjadnaqvi/stata-trimap/main/installation/\") replace\n```\n\nThe following packages are required to run this command:\n\n```stata\nssc install geoplot, replace\nssc install ternary, replace\nssc install palettes, replace\nssc install colrspace, replace\nssc install moremata, replace\n```\n\nEven if you have the package installed, make sure that it is updated `ado update, update`.\n\nIf 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:\n\n```stata\nssc install schemepack, replace\nset scheme white_tableau  \n```\n\nYou can also push the scheme directly into the graph using the `scheme(schemename)` option. See the help file for details or the example below.\n\nI also prefer narrow fonts in figures with long labels. You can change this as follows:\n\n```stata\ngraph set window fontface \"Arial Narrow\"\n```\n\n\n## Syntax\n\nThe syntax for the latest version is as follows:\n\n```stata\n        trimap varL varR varB [if] [in], \n\t[ frame(frame name) cuts(num) normalize(1|100) geo(layers) geopost(options) zoom fill\n          points lines labels colorL(str) colorR(str) colorB(str) lwidth(str) msize(str) malpha(num) mcolor(str) mlcolor(str)\n          mlwidth(str) leglwidth(str) leglcolor(str) mlabel(var) mlabsize(str) mlabcolor(str) mlabposition(str) xscale(num) yscale(num) * ]\n```\n\n\nSee the help file `help trimap` for details.\n\nThe most basic use is as follows:\n\n```\ntrimap varL varR varB, frame(framename)\n```\n\nrepresenting left, right and bottom variables respectively. The framename is the frame in which the data is stored.\n\n## Citation guidelines\nSoftware packages take countless hours of programming, testing, and bug fixing. If you use this package, then a citation would be highly appreciated. Suggested citations:\n\n\n*in BibTeX*\n\n```\n@software{trimap,\n   author = {Naqvi, Asjad},\n   title = {Stata package ``trimap''},\n   url = {https://github.com/asjadnaqvi/stata-trimap},\n   version = {1.1},\n   date = {2024-09-12}\n}\n```\n\n*or simple text*\n\n```\nNaqvi, A. (2024). Stata package \"trimap\" version 1.1. Release date 12 September 2024. https://github.com/asjadnaqvi/stata-trimap.\n```\n\n\n*or see [SSC citation](XXXX) (updated once a new version is submitted)*\n\n\n\n\n## Examples\n\n\n### Data setup\n\nGet the shapefiles\n\n```stata\nforeach x in NUTS0 NUTS0_shp NUTS1 NUTS1_shp NUTS2 NUTS2_shp NUTS3 NUTS3_shp {\n\tcopy \"https://github.com/asjadnaqvi/stata-trimap/raw/main/data/`x'.dta\" \"`x'.dta\", replace\n}\n```\n\n\nGet the data files\n\n```stata\nforeach x in NUTS3_pop NUTS3_gva NUTS2_edu NUTS2_tourstay {\n\tcopy \"https://github.com/asjadnaqvi/stata-trimap/raw/main/data/`x'.dta\" \"`x'.dta\", replace\n}\n```\n\n\nSet up the data:\n\n```stata\ngeoframe create nuts0, replace\ngeoframe create nuts1, replace\ngeoframe create nuts2, replace\ngeoframe create nuts3, replace\n```\n\n```\nframes change nuts3\n\n\nmerge 1:1 NUTS_ID using NUTS3_pop\ndrop if _m==2\ndrop _m\n\n\nformat *prop %5.0f\n```\n\nTest if `geoplot` is working correctly:\n\n```stata\ngeoplot ///\n\t(area nuts3 y15prop, cuts(0(10)100) )  ///\n\t(line nuts0, lc(white) lw(0.2))  ///\n\t, tight title(\"Population share 15-64\")\n\t\n\t\ngeoplot ///\n\t(area nuts3 y64prop, cuts(0(10)100) )  ///\n\t(line nuts0, lc(white) lw(0.2))  ///\n\t, tight\ttitle(\"Population share 0-14\")\n\t\n\t\ngeoplot ///\n\t(area nuts3 y99prop, cuts(0(10)100) )  ///\n\t(line nuts0, lc(white) lw(0.2))  ///\n\t, tight\ttitle(\"Population share 65+\")\t\n```\n\nwhich gives us:\n\n\u003cimg src=\"/figures/geoplottest1.png\" width=\"48%\"\u003e\u003cimg src=\"/figures/geoplottest2.png\" width=\"48%\"\u003e\n\u003cimg src=\"/figures/geoplottest3.png\" width=\"48%\"\u003e\n\n\n```stata\nternary y99prop y15prop y64prop, points \n```\n\n\u003cimg src=\"/figures/ternary_test.png\" width=\"100%\"\u003e\n\n\n\n### Test the command\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) mlc(white)\n```\n\n\u003cimg src=\"/figures/trimap1.png\" width=\"100%\"\u003e\n\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) mlc(white) ///\n geo( (line nuts0, lc(white) lw(0.05)) )\n```\n\n\u003cimg src=\"/figures/trimap2.png\" width=\"100%\"\u003e\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom mlc(white) cuts(4) ///\n\tgeo( (line nuts0, lc(white) lw(0.05)) )\t norm(1)\n```\n\n\u003cimg src=\"/figures/trimap2_1.png\" width=\"100%\"\u003e\n\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom mlc(white) cuts(4) ///\n\tgeo( (line nuts0, lc(white) lw(0.05)) )\t\n```\n\n\u003cimg src=\"/figures/trimap3.png\" width=\"100%\"\u003e\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) mlc(white)  ///\n\tgeo((line nuts0, lc(white) lw(0.05)))\n```\n\n\u003cimg src=\"/figures/trimap4.png\" width=\"100%\"\u003e\n\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) ///\ngeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\n```\n\n\u003cimg src=\"/figures/trimap5.png\" width=\"100%\"\u003e\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msym(point) \n```\n\n\u003cimg src=\"/figures/trimap6.png\" width=\"100%\"\u003e\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msize(0.5) mcolor(white%50) leglc(black) mlc(white)\n```\n\n\u003cimg src=\"/figures/trimap7.png\" width=\"100%\"\u003e\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(2) ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msize(0.5) mcolor(white%60) leglc(black) mlc(white)\t\n```\n\n\u003cimg src=\"/figures/trimap8.png\" width=\"100%\"\u003e\n\n```stata\ntrimap y99prop y15prop y64prop, frame(nuts3) zoom cuts(4) ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msize(0.5) mcolor(white%60) leglc(black) colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) mlc(white)\n```\n\n\u003cimg src=\"/figures/trimap9.png\" width=\"100%\"\u003e\n\n### Try another layer\n\n```stata\nmerge 1:1 NUTS_ID using NUTS3_gva\ndrop if _m==2\ndrop _m\n```\n\n\n```stata\ntrimap  gva_tertiary gva_primary gva_secondary, frame(nuts3) cuts(4) ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) msize(0.3) mcolor(black%60) mlc(none) \n```\n\n\u003cimg src=\"/figures/trimap10.png\" width=\"100%\"\u003e\n\n```stata\ntrimap  gva_secondary gva_tertiary gva_primary , frame(nuts3)   ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) msize(0.3) mcolor(black%60) mlc(none) \n```\n\n\u003cimg src=\"/figures/trimap11.png\" width=\"100%\"\u003e\n\n```stata\ntrimap  gva_secondary gva_tertiary gva_primary , frame(nuts3)  cuts(8) ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill colorB(#FFFF00) colorL(#F11D8C) colorR(#01A0C6) msize(0.3) mcolor(black%60) mlc(none) \n```\n\n\u003cimg src=\"/figures/trimap12.png\" width=\"100%\"\u003e\n\n### And other layers at the NUTS2 level\n\n```stata\nframe change nuts2\t\t\t\n\n\nmerge 1:1 NUTS_ID using NUTS2_edu\ndrop if _m==2\ndrop _m\n\ntrimap edu_primary  edu_secondary edu_tertiary, frame(nuts2)  cuts(2)  ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msize(0.4) mcolor(black%60) mlc(none) \n```\n\n\u003cimg src=\"/figures/trimap13.png\" width=\"100%\"\u003e\n\n\n```\ntrimap edu_primary  edu_secondary edu_tertiary, frame(nuts2) zoom  cuts(2)  ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msize(0.4) mcolor(black%60) mlc(none) \n```\n\n\u003cimg src=\"/figures/trimap13_zoom.png\" width=\"100%\"\u003e\n\n\n\n\n```stata\nmerge 1:1 NUTS_ID using NUTS2_tourstay.dta\ndrop if _m==2\ndrop _m\t\n\ntrimap  tour_hotels tour_other tour_camping , frame(nuts2)  cuts(4) zoom  ///\n\tgeo( (line nuts1, lc(white) lw(0.05)) (line nuts0, lc(white) lw(0.2)) )\t///\n\tfill msize(0.4) mcolor(black%60) mlc(none) \n```\n\n\u003cimg src=\"/figures/trimap14.png\" width=\"100%\"\u003e\n\n\n\n## Feedback\n\nPlease open an [issue](https://github.com/asjadnaqvi/stata-trimap/issues) to report errors, feature enhancements, and/or other requests. \n\n\n## Change log\n\n**v1.1 (12 Sep 2024)**\n- Package aligned with `ternary` by adding options `norm()`, `mlabel()`, `mlabcolor()`, `mlabposition()`, `mlabsize()`.\n- Better `zoom`.\n- Minor cleanups.\n\n**v1.0 (28 Aug 2024)**\n- First release.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasjadnaqvi%2Fstata-trimap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasjadnaqvi%2Fstata-trimap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasjadnaqvi%2Fstata-trimap/lists"}