Installation | Syntax | Citation guidelines | Examples | Feedback | Change log
(11 Jun 2024)
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.21):
ssc install bumparea, replace
GitHub (v1.31):
net install bumparea, from("https://raw.githubusercontent.com/asjadnaqvi/stata-bumparea/main/installation/") replace
The palettes
package is required to run this command:
ssc install palettes, replace
ssc install colrspace, replace
Even if you have these packages installed, please check for updates: 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"
The syntax for the latest version is as follows:
bumparea y x [if] [in], by(varname)
[ top(num) dropother smooth(num) palette(str) labcond(str) offset(num) alpha(num)
lcolor(str) lwidth(str) percent format(fmt) recenter(mid|top|bot) colorby(name) colorvar(var) colother(str)
xlabel(str) xtitle(str) ytitle(str) title(str) subtitle(str) note(str)
ysize(num) xsize(num) scheme(str) name(str) saving(str) ]
See the help file help bumparea
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.
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{bumparea,
author = {Naqvi, Asjad},
title = {Stata package ``bumparea''},
url = {https://github.com/asjadnaqvi/stata-bumparea},
version = {1.31},
date = {2024-06-11}
}
or simple text
Naqvi, A. (2024). Stata package "bumparea" version 1.31. Release date 11 June 2024. https://github.com/asjadnaqvi/stata-bumparea.
or see SSC citation (updated once a new version is submitted)
Load the Stata dataset
use "https://github.com/asjadnaqvi/stata-bumparea/blob/main/data/owid_emissions_reduced.dta?raw=true", clear
drop if iso_code==""
keep if year >= 1990
Let's test the bumparea
command:
bumparea total_ghg year, by(country)
bumparea total_ghg year, by(country) top(10) ///
xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
percent labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
dropother percent labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) ///
top(12) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
smooth(1) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
smooth(8) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
recenter(top) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
recenter(bot) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
lc(black) lw(0.03) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
lc(black) lw(0.03) palette(reds, reverse) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
lc(black) lw(0.03) palette(viridis) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
lc(black) lw(0.03) palette(CET C6) alpha(100) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
lc(black) lw(0.03) palette(CET C6) alpha(50) dropother labs(2) xsize(2) ysize(1)
bumparea total_ghg year, by(country) smooth(6) palette(CET L20) labs(2) ///
top(10) dropother recenter(mid) alpha(90) lw(0.15) xlaba(45) ///
title("Top 10 countries by annual GHG emissions", size(6)) ///
note("Source: OWID.") ///
xsize(2) ysize(1)
use "https://github.com/asjadnaqvi/stata-bumparea/blob/main/data/owid_emissions_reduced.dta?raw=true", clear
drop if iso_code==""
keep if inlist(year, 1990, 1993, 1997, 2000, 2005, 2007, 2010, 2014, 2017, 2019)
bumparea total_ghg year, by(country) smooth(8) palette(CET L08) labs(2) ///
top(15) dropother recenter(mid) alpha(80) lw(0.1) xlaba(45) ///
title("Top 10 countries by annual GHG emissions", size(6)) ///
note("Source: OWID. bumparea package. @AsjadNaqvi") ///
xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) ///
xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) colother(gs6) ///
xsize(2) ysize(1)
bumparea total_ghg year, by(country) top(10) colorby(name) ///
xsize(2) ysize(1
cap drop cats
gen cats = .
replace cats = 1 if inlist(country, "Indonesia", "Japan")
replace cats = 2 if inlist(country, "United States", "Canada")
replace cats = 3 if inlist(country, "Iran", "Saudi Arabia")
replace cats = 4 if inlist(country, "China")
bumparea total_ghg year, by(country) top(10) colorvar(cats) ///
xsize(2) ysize(1) colo(white)
Please open an issue to report errors, feature enhancements, and/or other requests.
v1.31 (11 June 2024)
- Added
wrap()
to wrap labels. - Several code updates.
v1.3 (26 May 2024)
- The command now sums and fills missing categories.
v1.21 (15 Jan 2024)
- Minor fixes.
- Updates to defaults.
v1.2 (25 Jul 2023)
- Several new options added:
colorby(name)
to alpha sort the colors,colorby(var)
to color using a customvar
,colother()
to define the color of the "Other" category. - A bug with labels fixed (found by Marc Kaulisch)
- Better checks for
by()
variables. saving()
option added.- Several small bug fixes and code optimizations.
v1.11 (06 Jun 2023)
- Minor bug fixes, checks, enhancements.
v1.1 (28 May 2023)
- Fixed
if
andin
conditions that were not passing correctly. - Added checks for duplicates.
- Minor code cleanups, updates to defaults, and help file.
v1.0 (10 Apr 2023)
- Public release.