Coder Social home page Coder Social logo

burd's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.