stata-polarspike
A Stata package for polar spike graphs
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found 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 (12.9%) to scientific vocabulary
Keywords
Repository
A Stata package for polar spike graphs
Basic Info
Statistics
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 1
Topics
Metadata Files
README.md
Installation | Syntax | Examples | Feedback | Change log
polarspike v1.0
(09 May 2024)
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):
ssc install polarspike, replace
Or it can be installed from GitHub (v1.0):
net install polarspike, from("https://raw.githubusercontent.com/asjadnaqvi/stata-polarspike/main/installation/") replace
The palettes package is required to run this command:
ssc install palettes, replace
ssc install colrspace, 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:
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:
graph set window fontface "Arial Narrow"
Syntax
The syntax for the latest version is as follows:
```stata polarspike var [if] [in], by(var1) [ over(var2) ] [ radmin(num) radmax(num) rotate(num) gap(num) palette(str) lwidth(str) format(str) labcolor(str) labgap(num) labsize(str) ocolor(str) ogap(num) osize(str) nolegend legsize(str) legposition(str) legcolumns(num) * ]
```
See the help file help polarspike for details.
Examples
Pull the data:
stata
use "https://github.com/asjadnaqvi/stata-polarspike/blob/main/data/gdp_per_capita.dta?raw=true", clear
Let's test the basic command:
polarspike rgdp_pc_ppp, by(countryname)

polarspike rgdp_pc_ppp, by(countryname) labgap(12) labsize(1) offset(10)

Rotation is great for optimizing the space:
polarspike rgdp_pc_ppp, by(countryname) labgap(8) labsize(1) offset(10) rotate(45)

Add colors by highlight different grouping in the graph:
polarspike rgdp_pc_ppp, by(countryname) labgap(8) labsize(1) offset(10) rotate(45) colorby(regionname)

polarspike rgdp_pc_ppp, by(countryname) labgap(8) labsize(1) offset(10) rotate(45) colorby(regionname) gap(0)

polarspike rgdp_pc_ppp, by(countryname) labgap(6) labsize(0.9) offset(10) rotate(45) colorby(regionname) gap(0) radmin(4) radmax(6) ///
title("Real GDP per capita in 2022 (constant 2017 USD)") note("Source: World Bank Open Data", size(1.2))

polarspike rgdp_pc_ppp, by(countryname) labgap(6) labsize(0.9) offset(10) rotate(45) colorby(regionname) gap(0) radmin(4) radmax(6) nolegend ///
title("Real GDP per capita in 2022 (constant 2017 USD)") note("Source: World Bank Open Data", size(1.2))

Condition the labels to only show values about a certain threshold:
polarspike rgdp_pc_ppp, by(countryname) labgap(6) labsize(0.9) offset(10) rotate(45) colorby(regionname) gap(0) radmin(4) radmax(6) nolegend labcond(10000) ///
title("Real GDP per capita in 2022 (constant 2017 USD)") note("Source: World Bank Open Data", size(1.2))

Plotting change
polarspike change, by(countryname) labgap(6) labsize(0.9) offset(10) rotate(45) colorby(regionname) gap(0) radmin(4) radmax(6) ///
title("5-year change in real GDP per capita (PPP) (2017-2022)") note("Source: World Bank Open Data", size(1.2))

Plotting by groups
polarspike rgdp_pc_ppp, by(countryname) over(regionname) labgap(8) labsize(1) offset(10) palette(CET C6) ///
title("Real GDP per capita in 2022 (constant 2017 USD)") note("Source: World Bank Open Data", size(1.2))

polarspike rgdp_pc_ppp, by(countryname) over(regionname) labgap(8) labsize(1) offset(10) palette(CET C6) radmin(4) radmax(7) ///
title("Real GDP per capita in 2022 (constant 2017 USD)") note("Source: World Bank Open Data", size(1.2))

polarspike change, by(countryname) over(regionname) labgap(6) labsize(0.9) offset(10) palette(CET C7) radmin(4) radmax(7) ///
title("Real GDP per capita in 2022 (constant 2017 USD)") note("Source: World Bank Open Data", size(1.2))

Feedback
Please open an issue to report errors, feature enhancements, and/or other requests.
Change log
v1.0 (09 May 2024) - First release
Owner
- Name: Asjad Naqvi
- Login: asjadnaqvi
- Kind: user
- Location: Vienna
- Company: WIFO
- Website: https://asjadnaqvi.github.io/
- Twitter: AsjadNaqvi
- Repositories: 52
- Profile: https://github.com/asjadnaqvi
Vienna, Austria
Citation (CITATION.cff)
cff-version: 1.2.0 authors: - family-names: "Naqvi" given-names: "Asjad" title: "Stata package ``polarspike''" version: 1.0 date-released: 2024-05-09 url: "https://github.com/asjadnaqvi/stata-polarspike"
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0