{"id":26334462,"url":"https://github.com/asjadnaqvi/stata-spider","last_synced_at":"2026-01-28T11:04:18.488Z","repository":{"id":113395588,"uuid":"550720214","full_name":"asjadnaqvi/stata-spider","owner":"asjadnaqvi","description":"spider: A Stata package for spider plots.","archived":false,"fork":false,"pushed_at":"2025-02-16T23:55:45.000Z","size":62329,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T06:34:46.658Z","etag":null,"topics":["ado","package","plot","spider","stata"],"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":".github/FUNDING.yml","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},"funding":{"github":"asjadnaqvi"}},"created_at":"2022-10-13T08:07:35.000Z","updated_at":"2025-02-17T18:29:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b6272d5-5652-4a1b-b62a-0f79349287a9","html_url":"https://github.com/asjadnaqvi/stata-spider","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"2aa3e3a6a0764ec2c6e55d0383e6d6f4f36b0fb8"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-spider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-spider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-spider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asjadnaqvi%2Fstata-spider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asjadnaqvi","download_url":"https://codeload.github.com/asjadnaqvi/stata-spider/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806668,"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","plot","spider","stata"],"created_at":"2025-03-16T00:19:05.634Z","updated_at":"2026-01-03T00:05:08.384Z","avatar_url":"https://github.com/asjadnaqvi.png","language":"Stata","funding_links":["https://github.com/sponsors/asjadnaqvi"],"categories":[],"sub_categories":[],"readme":"![StataMin](https://img.shields.io/badge/stata-2015-blue) ![issues](https://img.shields.io/github/issues/asjadnaqvi/stata-spider) ![license](https://img.shields.io/github/license/asjadnaqvi/stata-spider) ![Stars](https://img.shields.io/github/stars/asjadnaqvi/stata-spider) ![version](https://img.shields.io/github/v/release/asjadnaqvi/stata-spider) ![release](https://img.shields.io/github/release-date/asjadnaqvi/stata-spider)\n\n[Installation](#Installation) | [Syntax](#Syntax) | [Citation guidelines](#Citation-guidelines) | [Examples](#Examples) | [Feedback](#Feedback) | [Change log](#Change-log)\n\n\n---\n\n![spider-1](https://github.com/asjadnaqvi/stata-spider/assets/38498046/43b0aa06-726f-4f87-92b7-45c2fd653e79)\n\n\n\n# spider v1.54\n(17 Dec 2025)\n\nThis package provides the ability to draw spiders Stata. It is based on the [Spider plots](https://medium.com/the-stata-guide/stata-graphs-spider-plots-613808b51f73) guide on Medium\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.53**):\n\n```\nssc install spider, replace\n```\n\nOr it can be installed from GitHub (**v1.54**):\n\n```stata\nnet install spider, from(\"https://raw.githubusercontent.com/asjadnaqvi/stata-spider/main/installation/\") replace\n```\n\n\nThe following dependencies are required:\n\n```stata\nssc install palettes, replace\nssc install colrspace, replace\nssc install graphfunctions, replace\n```\n\nPlease note that `graphfunctions` is a new program with features rolling out regularly. In case the SSC version is not working, please update it directly from the [graphfunctions](https://github.com/asjadnaqvi/stata-graphfunctions) repository. See the link for instructions.\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\nspider var [if] [in] [weight], \n                [ by(var) over(var) alpha(num 0-100) rotate(num) smooth(num 0-1) palette(str)\n                  range(numlist) cuts(num) lwidth(str) lpattern(list) msymbol(list) rotatelabel\n                  format(fmt) wrap(num) msize(str) mlwidth(str) displacelab(num) displacespike(num) grid  \n                  gcolor(str) gwidth(str) gpattern(str) glabsize(str) glabcolor(str) glabangle(str) glabopsition(str) \n                  rline(numlist) rlinecolor(str) rlinewidth(str) rlinepattern(str)\n                  scolor(str) swidth(str) slabsize(str) slabcolor(str)\n                  nolegend legpositon(num) legpositon(num) legcolumns(num) legsize(num) xsize(num) ysize(num)\n                  stat(mean|sum) pad(num) * ]\n```\n\nSee the help file `help spider` for details.\n\nBasic syntax 1: Wide form\n\n```stata\nspider variables, over(var)\n```\n\nBasic syntax 2: Long form\n\n```stata\nspider variable, by(var) over(var)\n```\n\nSee help file for details.\n\n## Citation guidelines\n\nSoftware packages take countless hours of programming, testing, and bug fixing. If you use this package, then a citation would be highly appreciated. \n\nThe [SSC citation](https://ideas.repec.org/c/boc/bocode/s459136.html) is recommended. Please note that the GitHub version might be newer than the SSC version.\n\n\n## Examples\n\nSet up the data:\n\n```stata\nclear\n\nuse \"https://github.com/asjadnaqvi/stata-spider/blob/main/data/spider_data2.dta?raw=true\", clear\n```\n\nand test the command:\n\n```stata\nspider index, by(policy) \n```\n\n\u003cimg src=\"/figures/spider1.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region)\n```\n\n\u003cimg src=\"/figures/spider1_2.png\" width=\"100%\"\u003e\n\n\n```stata\nspider index, by(policy) over(region) alpha(0)\n```\n\n\u003cimg src=\"/figures/spider2.png\" width=\"100%\"\u003e\n\n\n```stata\nspider index, by(policy) over(region) alpha(0) msym(none)\n```\n\n\u003cimg src=\"/figures/spider3.png\" width=\"100%\"\u003e\n\n\n```stata\nspider index, by(policy) over(region) alpha(0) msym(square) msize(0.2) ra(0(20)100)\n```\n\n\u003cimg src=\"/figures/spider4.png\" width=\"100%\"\u003e\n\n\n```stata\nspider index, by(policy) over(region) alpha(0) rot(30)\n```\n\n\u003cimg src=\"/figures/spider5.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) alpha(0) rot(30) rotatelab\n```\n\n\u003cimg src=\"/figures/spider5_1.png\" width=\"100%\"\u003e\n\n\n### Smooth the spiders\n\n```stata\nspider index if inlist(region,1,6), by(policy) over(region) ra(10(10)80) alpha(2) rot(30) format(%6.0f)\n\nspider index if inlist(region,1,6), by(policy) over(region) ra(10(10)80) alpha(2) rot(30) format(%6.0f) smooth(0)\n\nspider index if inlist(region,1,6), by(policy) over(region) ra(10(10)80) alpha(2) rot(30) format(%6.0f) smooth(0.5)\n\nspider index if inlist(region,1,6), by(policy) over(region) ra(10(10)80) alpha(2) rot(30) format(%6.0f) smooth(1)\n```\n\n\u003cimg src=\"/figures/spider7.png\"   width=\"50%\"\u003e\u003cimg src=\"/figures/spider7_1.png\" width=\"50%\"\u003e\n\u003cimg src=\"/figures/spider7_2.png\" width=\"50%\"\u003e\u003cimg src=\"/figures/spider7_3.png\" width=\"50%\"\u003e\n\n### Palettes\n\n```stata\nspider index, by(policy) over(region) smooth(0.1) palette(tol vibrant) lw(0.4) msym(none) alpha(2) rot(30) format(%6.0f)\n```\n\n\u003cimg src=\"/figures/spider8_1.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) smooth(0.1) palette(carto Bold) lw(0.4) msym(none) alpha(2) rot(30) format(%6.0f)\n```\n\n\u003cimg src=\"/figures/spider8_2.png\" width=\"100%\"\u003e\n\n\n### Customize grids and spikes\n\n\n```stata\nspider index, by(policy) over(region) ra(10(10)80) smooth(0.1) gc(eltblue) gw(0.05) rot(30) format(%6.0f)\n```\n\n\u003cimg src=\"/figures/spider9_1.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) ra(10(10)80) smooth(0.1) gc(eltblue) gw(0.05) sc(black) sw(0.1) rot(30) format(%6.0f)\n```\n\n\u003cimg src=\"/figures/spider9_2.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) ra(10(10)80) smooth(0.1) gc(eltblue) gw(0.05) sc(eltblue) sw(0.3) displacelab(20) displacespike(10) rotatelab rot(30) format(%6.0f)\n```\n\n\u003cimg src=\"/figures/spider9_3.png\" width=\"100%\"\u003e\n\n### Legends and custom dimensions (v1.2)\n\n```stata\nspider index, by(policy) over(region) smooth(0) alpha(5) rot(30) format(%6.0f) xsize(4) ysize(3) \n```\n\n\u003cimg src=\"/figures/spider9_4.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) smooth(0) alpha(5) rot(30) format(%6.0f) xsize(4) ysize(3) legpos(3) legcol(1)\n```\n\n\u003cimg src=\"/figures/spider9_5.png\" width=\"100%\"\u003e\n\n\nAdditional features from v1.5:\n\n```stata\nspider index if inlist(region,1,2), by(policy) over(region) smooth(0) alpha(10) rot(15) format(%6.0f) xsize(4) ysize(3) legpos(3) legcol(1) wrap(6) grid range(0 10 20 40 80) rline(35) msym(circle square) msize(0.8)\n```\n\n\u003cimg src=\"/figures/spider9_6.png\" width=\"100%\"\u003e\n\n### Try a different scaling\n\n```stata\ngen index2 = index / 100\n\nspider index2, by(policy) over(region) ra(0.1(0.1)0.8) format(%5.1f) rot(30)  smooth(0) alpha(0) glabs(2)\n```\n\n\u003cimg src=\"/figures/spider10.png\" width=\"100%\"\u003e\n\n### Range label options (v1.21)\n\n```stata\nspider index2, by(policy) over(region) ra(0.1(0.1)0.8) format(%5.1f)  rot(30) smooth(0) alpha(0) glabc(blue) glabs(1.5) glaba(-90)\n```\n\n\u003cimg src=\"/figures/spider11.png\" width=\"100%\"\u003e\n\n\n### v1.4 options\n\nWord wrapping\n\n```stata\nspider index, by(policy) over(region) smooth(0) alpha(5) wrap(5) rot(30)\n```\n\n\u003cimg src=\"/figures/spider12.png\" width=\"100%\"\u003e\n\n\nLet's make our data wide:\n\n```stata\nencode policy, gen(policy2)\n\nsumm policy2, meanonly\nlocal items = r(max)\n\nforval i = 1 /`items' {\n\tlocal val`i' : label policy2 `i' \n}\n\n\n\ncollapse (mean) index, by(policy2 region)\n\n\nreshape wide index, i(region) j(policy2) \n\nforval i = 1 / `items' {\n\tlab var index`i' \"`val`i''\"\n}\n\n\nspider index*, over(region) smooth(0) alpha(5) wrap(5)  rot(30)\n```\n\n\u003cimg src=\"/figures/spider13.png\" width=\"100%\"\u003e\n\n\n### v1.5 options: grid + lists + reference lines.\n\nReload the data:\n\n```stata\nuse \"https://github.com/asjadnaqvi/stata-spider/blob/main/data/spider_data2.dta?raw=true\", clear\n```\n\n\n```stata\nspider index, by(policy) over(region) alpha(0) wrap(8) ra(0(20)80) format(%5.0f) rot(30)\n```\n\n\u003cimg src=\"/figures/spider14.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) alpha(0) wrap(8) ra(0 10 30 50 70 80) format(%5.0f) rot(30)\n```\n\n\u003cimg src=\"/figures/spider14_1.png\" width=\"100%\"\u003e\n\n\n```stata\nspider index, by(policy) over(region) alpha(0) wrap(8) ra(0(20)80) format(%5.0f) grid rot(30)\n```\n\n\u003cimg src=\"/figures/spider15.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) alpha(0) wrap(8) ra(0(20)80) format(%5.0f) grid rline(25 50 70) rlinew(0.2) rlinec(black) rot(30)\n```\n\n\u003cimg src=\"/figures/spider16.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) alpha(0) wrap(8) ra(0(20)80) cuts(5) format(%5.0f) ///\n\tmsym(S T O +) msize(1.2) rot(30)\n```\n\n\u003cimg src=\"/figures/spider17.png\" width=\"100%\"\u003e\n\n```stata\nspider index, by(policy) over(region) alpha(0) wrap(8) ra(0(20)80) cuts(5) format(%5.0f) ///\n\tlp(dash dot solid -- -.-) rot(30)\n```\n\n\u003cimg src=\"/figures/spider18.png\" width=\"100%\"\u003e\n\n\n### Bonus: Valentines day spending spider graph\n\nHere is a proper example of data in wide form, which in previous versions (\u003cv1.4) would have required reshaping the data:\n\n```stata\nset scheme white_tableau\ngraph set window fontface \"Abel\"\n\nimport delim using \"https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-02-13/gifts_gender.csv\", clear\n\nlab var spendingcelebrating \"Spending celebrating\"\nlab var greetingcards \"Greeting cards\"\nlab var eveningout \"Evening out\"\nlab var giftcards \"Gift cards\"\n\nspider spendingcelebrating- giftcards, over(gender) smooth(0.2) alpha(15) lw(0.4) palette(w3 default, select(1 4)) rotatelab ///\n\tlegcol(3) legsize(3) msize(0.15) sc(black) ccolor(gs13) range(0 60) cuts(7) format(%5.0f) displacelab(15) slabsize(2) wrap(5) ///\n\ttitle(\"{fontface Merriweather Bold:♥ Candy crush ♥}\", size(7) color(cranberry))  ///\n\tsubtitle(\"(Percentage positive respones by spending category)\", size(2)) ///\n\tnote(\"Source: TidyTuesday, 14th Feb 2024.\", size(1.5)) ///\n\tplotregion(margin(t-5 b-5 l-20 r-20))\n```\n\n\u003cimg src=\"/figures/valentines2024.png\" width=\"100%\"\u003e\n\n\nHere is another version which showcases v1.5 updates:\n\n```stata\nspider spendingcelebrating- giftcards, over(gender) smooth(0.2) alpha(15) lw(0.4) palette(w3 default, select(1 4)) rotatelab  rline(25 50)  ///\n\tlegcol(3) legsize(3) msize(0.15) sc(black) gcolor(gs13)  format(%5.0f) displacelab(20) glabsize(2) wrap(5) ///\n\tplotregion(margin(l-20 r-20)) ra(0(10)60) grid lp(solid dash) ///\n\ttitle(\"{fontface Merriweather Bold:Valentines day spending by gender}\", size(5) color(cranberry))  ///\n\tnote(\"Source: TidyTuesday, 14th Feb 2024.\", size(1.5)) \n```\n\u003cimg src=\"/figures/valentines2024_v2.png\" width=\"100%\"\u003e\n\n## Feedback\n\nPlease open an [issue](https://github.com/asjadnaqvi/stata-spider/issues) to report errors, feature enhancements, and/or other requests. \n\n\n## Change log\n\n\n**v1.54 (17 Dec 2025)**\n- Fixed a zero radius issue being raised by `graphfunctions` that now have stricter checks.\n\n**v1.53 (14 Jan 2025)**\n- Several code updates.\n- Added checks for dependencies.\n- `legoptions()` added to allow users to micro finetune the legends.\n- Several bug fixes.\n\n**v1.52 (07 Jan 2025)**\n- Fix a major bug where missing values were resulting in the wrong categories. \n- Various other bug fixes.\n\n**v1.51 (09 Nov 2024)**\nA minor release with some major changes\n- Starting point is now the 12 o' clock (North) position. This has been requested countless times. One can still rotate by 90 degrees to start from the old (Stata) default 3 o' clock (East) position.\n- Draw order is now clockwise. Again requested a lot. Users can change the direction to counter-clockwise by using the new option `flip`.\n- Labels are now on the starting north-facing line.\n- First category now correctly shows on the first position. Previously it was on the second position.\n- Fix a bug where non-integer values under certain conditions were causing the program to crash.\n- Minor Code cleanups.\n\n**v1.5 (13 Oct 2024)**\n- Now requires dependency [graphfunctions](https://github.com/asjadnaqvi/stata-graphfunctions) (check versions and update to the latest!). \n- Options `msymbol()` and `lwidth()` now take lists. If there are less elements than the number of lines, then the last values are inherited by the remaining lines.\n- Added option `grid` which draws straight lines as grids rather than circles. \n- Added options `rline()`, `rlinec()`, `rlinep()`, `rlinew()` for reference lines. Can take lists.\n- `c*()` options changes to `g*()` options to reflect grid line values. E.g. `ccolor()` changed to `gcolor()`.\n- `ra*()` options renamed to `g*()` options to reflect grid label values. E.g. `ralabelsize()` changed to `glabelsize()`.\n- Option `range()` now accepts numerical lists (numlist). This makes `cuts()` almost redundant but it can still be used if no custom range is specified and one needs to increase the number of cuts for auto-calculated ranges.\n- Option `gwidth()` added.\n- Several updates to defaults.\n- Minor code cleanups.\n\n**v1.4 (04 Oct 2024)**\n- Weights are now allowed.\n- Users can now specify variable lists (wide form) in addition to long form data. See help file.\n- Added `pad()` to control minmax displacement of the axis range\n- Added `wrap()` to allow text wrapping. Requires the `graphfunctions` package.\n- Added `n()` to control how many points are generated to plot the splines between two points.\n- Added `stat()` where users can choose between `stat(mean)` (default) or `stat(sum)` if the data is collapsed.\n- Code cleanup.\n\n**v1.33 (02 Jul 2024)**\n- Fixed a minor error where numeric `over()` and `by()` were not being labeled correctly.\n\n**v1.32 (11 Jun 2024)**\n- Added `wrap()` to wrap labels.\n\n**v1.31 (11 May 2024)**\n- changed `raformat()` to just `format()` to standardize the use across packages.\n- `format()` default improved to show decimals.\n- Checks added for `by()` and `over()` to have minimum number of accepted categories.\n- Stata default passthru options improved.\n\n**v1.3 (16 Feb 2024)**\n- Complete rework of the package to take in the data in the long form. While this might be convinient for users who were using it for wide data, the newer version handle the data and labels better and is faster. The wide option might still be added back in later. Please note that change in the `by()` and `over()` options.\n- `rotatelabel` option added.\n- Better legend controls. Please make sure value labels are properly defined that are passed on to legends.\n\n**v1.23 (12 Nov 2023)**\n- Added support for `slabcolor()` (requested by Christian Gessinger).\n- Added `saving()`.\n\n**v1.22 (07 Jul 2023)**\n- Fixed a bug where labeled `over()` categories were not passing correctly (reported by Kamala Kaghoma).\n\n**v1.21 (10 Jun 2023)**\n- Two options added for range labels: `ralabcolor()`, `ralabangle()`.\n\n**v1.2 (20 May 2023)**\n- Several legend options added (requested by Marc Kaulisch). These include `nolegend`, `legendpos()`, `legendsize()`, `legendcol()`.\n- `xsize()` and `ysize()` added to allow users to control the dimensions.\n- Minor code cleanups.\n- Help file cleanup.\n\n**v1.1 (24 Dec 2022)**\n- Fixed some bugs.\n- Better checks for merges.\n\n**v1.0 (13 Oct 2022)**\n- First release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasjadnaqvi%2Fstata-spider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasjadnaqvi%2Fstata-spider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasjadnaqvi%2Fstata-spider/lists"}