Skip to content
/ burd Public

A blue-red Stata colour scheme that supports up to 11 diverging classes.

Notifications You must be signed in to change notification settings

briatte/burd

Repository files navigation

This repository contains the development version of the burd Stata scheme. The burd Stata graph scheme is a reverse implementation of Cynthia Brewer's ColorBrewer RdBu diverging color scheme. I use it to teach a Stata course that is also available from GitHub.

HOWTO

Install the scheme from SSC with the following command:

ssc install scheme-burd, replace

Type help scheme_burd for usage notes, and see this blog entry for further details and examples.

CREDITS

All credits due to Cynthia Brewer for ColorBrewer.

Thanks to Christopher Baum for making the package available via SSC/RePEc.

NOTES

  • The scheme is similar to the BuRd scheme that appears in Maurizio Pisati's spmap command for spatial data. Its default settings further draw on Edwin Leuven's schemes, which in turn draw on Svend Juul's lean schemes.
  • The qualitative colors roughly match those of s2color with those from the 7-class diverging schemes from ColorBrewer, and the scheme falls back on s2color after the ninth data class. Bar colors are shown at 50% intensity. These settings have not been tested for color blindness.
  • The scheme-burd3 to scheme-burd11 files implement diverging blue-red colors for up to 11 data classes. The appropriate scale should be passed with the scheme(burd#) option, where # is the number of diverging data classes.

EXAMPLES

use data/nhis2009, clear // National Health Interview Survey data
spineplot health raceb, scheme(burd5) // requires the spineplot package

Imgur

use data/gss2010 if year == 2010, clear // General Social Survey data
tab happy, gen(h_)
gr bar h_?, over(polviews, lab(angle(25))) stack percent ///
  ti("General happiness") yti(%) ///
  legend(order(1 "happy" 2 "pretty happy" 3 "not too happy") row(1)) ///
  scheme(burd3)

Imgur

use data/ess2008, clear // European Social Survey data
tab trrtort, gen(torture_)
gr hbar torture_* [aw=dweight], stack percent over(cntry, sort(1)des lab(labsize(*.8))) ///
  ti("Torture is never justified even to prevent terrorism") yti("") ///
  legend(rows(1) order(1 "Strongly agree" 2 "" 3 "Neither" 4 "" 5 "Strongly disagree")) ///
  scheme(burd5)

Imgur

use data/qog2011, clear // Quality of Government data
cap gen y = wdi_fr
cap gen x = bl_asyf25
cap drop q
xtile q = y, nq(4)
local mark "ms(i) mlab(ccodewb) mlabp(0)"
local plot "sc y x if q==1, scheme(burd4) `mark'"
forval i = 2/4 {
  local plot = "`plot' || sc y x if q==`i', `mark'"
}
tw `plot' legend(off) yti(Fertility rate) xti(Female education years)

Imgur

Matrixes

Imgur

Imgur

Comparisons

Imgur

Imgur

Imgur

About

A blue-red Stata colour scheme that supports up to 11 diverging classes.

Resources

Stars

Watchers

Forks

Packages

No packages published