stata-bumpline

A Stata package for bump line charts

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

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 (12.5%) to scientific vocabulary

Keywords

bump line package stata
Last synced: 6 months ago · JSON representation

Repository

A Stata package for bump line charts

Basic Info
  • Host: GitHub
  • Owner: asjadnaqvi
  • License: mit
  • Language: Stata
  • Default Branch: main
  • Homepage:
  • Size: 15.2 MB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • Open Issues: 6
  • Releases: 5
Topics
bump line package stata
Created almost 3 years ago · Last pushed 11 months ago
Metadata Files
Readme Funding License Citation

README.md

StataMin issues license Stars version release

Installation | Syntax| Citation guidelines | Examples | Feedback | Change log


bumpline-1

bumpline v1.4

(16 Feb 2025)

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.

SSC (v1.4):

ssc install bumpline, replace

GitHub (v1.4):

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

Please make sure that you have the latest versions of the following packages installed:

ssc install palettes, replace ssc install colrspace, replace ssc install graphfunctions, 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

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 bumpline y x [if] [in] [weight], by(varname) [ top(num) select(any|last) smooth(num) palette(str) colorby(var) labcond(str) offset(num) dropother wrap(num) stat(mean|sum) lwidth(str) lpattern(str) msize(str) msymbol(str) mcolor(str) mlcolor(str) mlwidth(str) labsize(str) labcolor(str) labangle(str) labposition(str) labgap(str) olcolor(str) olwidth(str) olpattern(str)
omcolor(str) omsymbol(str) omsize(str) omlcolor(str) omlwidth(str)
olabsize(str) olabcolor(str) olabangle(str) olabposition(str) olabgap(str) ylabsize(str) * ]

```

See the help file help bumpline for details.

The most basic use is as follows:

bumparea y x, by(group)

where y is a numerical variable we want to plot and x is the time dimension. Both need to be numeric. The by() is the category variable.

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.

The SSC citation is recommended. Please note that the GitHub version might be newer than the SSC version.

Examples

Load the Stata dataset

```stata use "https://github.com/asjadnaqvi/stata-bumpline/blob/main/data/owidemissionsreduced.dta?raw=true", clear

drop if iso_code==""

// keep a random set of years keep if inlist(year, 1990, 1992, 1995, 2000, 2005, 2007, 2010, 2013, 2016, 2019) ```

Let's test the bumpline command:

bumpline total_ghg year, by(country)

bumpline total_ghg year, by(country) top(10) /// xsize(2) ysize(1)

bumpline total_ghg year, by(country) select(last) top(10) /// xsize(2) ysize(1)

Smooth

bumpline total_ghg year, by(country) top(10) /// smooth(1) xsize(2) ysize(1)

bumpline total_ghg year, by(country) top(10) /// smooth(8) xsize(2) ysize(1)

top lists

bumpline total_ghg year, by(country) top(10) /// top(15) xsize(2) ysize(1)

bumpline total_ghg year, by(country) top(10) /// top(20) xsize(2) ysize(1)

bumpline total_ghg year, by(country) top(10) dropother /// top(20) xsize(2) ysize(1)

Palettes

bumpline total_ghg year, by(country) top(10) /// palette(CET L20) xsize(2) ysize(1)

bumpline total_ghg year, by(country) top(10) /// palette(viridis) xsize(2) ysize(1)

bumpline total_ghg year, by(country) top(10) /// palette(reds, reverse) xsize(2) ysize(1)

Lines and symbols

bumpline total_ghg year, by(country) top(10) /// lw(1.4) xsize(2) ysize(1)

bumpline total_ghg year, by(country) top(10) /// lw(1.2) msym(square) msize(1.3) xsize(2) ysize(1)

stata bumpline total_ghg year, by(country) top(12) /// smooth(4) palette(CET L04) /// lw(0.8) msym(square) mlwid(0.3) msize(1) offset(20) /// title("Top 30 countries by annual GHG emissions", size(6)) /// note("Source: OWID.") /// xsize(4) ysize(2)

stata bumpline total_ghg year, by(country) top(12) /// smooth(4) palette(CET L04) /// lw(0.8) msym(square) mlwid(0.3) msize(1) offset(20) /// title("Top 30 countries by annual GHG emissions", size(6)) /// note("Source: OWID.") /// xsize(4) ysize(2)

v1.3

```stata graph set window fontface "Abel"

bumpline total_ghg year, by(country) ///
smooth(4) top(20) palette(CET L04) /// lw(0.5) msym(square) mlwid(0.3) msize(0.4) xlabel(, angle(90)) offset(20) labsize(2) /// title("{fontface Merriweather Bold:Top 30 countries by annual GHG emissions}", size(6)) /// note("Source: Our World in Data. bumpline package. @AsjadNaqvi.") /// xsize(8) ysize(5) ```

```stata use "https://github.com/asjadnaqvi/stata-bumpline/blob/main/data/owidemissionsreduced.dta?raw=true", clear drop if iso_code=="" drop if year < 1995

levelsof year if !missing(gdp)

bumpline total_ghg year [aw = gdp], by(country) wrap(20) dropother /// smooth(8) top(16) palette(CET L20, reverse) labc(white) /// lw(0.8) msym(square) mlwid(0.3) msize(0.5) xlabel("`r(levels)'", angle(90) labsize(2)) offset(10) labsize(2.6) /// title("{fontface Merriweather Bold:Top 30 countries by annual GHG emissions (GDP weighted)}", size(6)) /// note("Source: Our World in Data. bumpline package.", size(1.6)) /// xsize(3) ysize(1) scheme(neon)

```

v1.4

Define a custom color variable:

```stata gen focus = .

replace focus = 1 if inlist(country, "China", "Japan", "Indonesia") replace focus = 2 if inlist(country, "United States", "Canada", "Brazil") ```

Pass it to the command and also control the colors:

stata bumpline total_ghg year, by(country) top(10) xsize(3) ysize(1) colorby(focus) palette(eltblue orange gs13) dropother

Feedback

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

Change log

v1.4 (16 Fen 2025) - colorby() option added. - Minor improvements to defaults and the syntax.

v1.3 (22 Oct 2024) - wrap() ported to graphfunctions. - Weights are now allowed. - Added options stat(mean) and stat(sum) (default) for collapsing the data. If the data has duplicate values, collapse will be used and a warning message will be displayed. - Added dropther to drop by() categories that start and end in the middle. - All possible line, marker, symbol, other line, other marker, other symbol options added for maximum control. - Removed x-axis options. Use the standard xlabel() with standard options. This provides the most control over the axis. - Major code clean up.

v1.21 (11 Jun 2024) - Added wrap() for label wrapping. - Several code improvements for faster rendering.

v1.2 (10 Feb 2024) - Fixes to how colors are assigned. - Minor cleanups.

v1.1 (28 May 2023) - Fixed if and in conditions that were not passing correctly. - Added checks for duplicates. - Removed graph grids. - Added mlabsize() for smaller labels. - Minor code cleanups, updates to defaults, and help file.

v1.0 (10 Apr 2023) - Public release.

Owner

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

Vienna, Austria

GitHub Events

Total
  • Create event: 2
  • Issues event: 4
  • Release event: 2
  • Watch event: 2
  • Issue comment event: 5
  • Push event: 5
Last Year
  • Create event: 2
  • Issues event: 4
  • Release event: 2
  • Watch event: 2
  • Issue comment event: 5
  • Push event: 5

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 12
  • Total pull requests: 0
  • Average time to close issues: 14 days
  • Average time to close pull requests: N/A
  • Total issue authors: 5
  • Total pull request authors: 0
  • Average comments per issue: 1.67
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 0
  • Average time to close issues: 3 months
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 0.67
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ericmelse (6)
  • mkaulisch (2)
  • asjadnaqvi (2)
  • sktanamas (1)
  • megdalynn (1)
Pull Request Authors
Top Labels
Issue Labels
enhancement (5) documentation (2)
Pull Request Labels