Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Waterfall plots

    I am working on a "Waterfall Plot" (as it is used in oncology) using Nick Cox's wonderful command "devnplot" in Stata 13.1. I would like to create a plot that uses different colored bars (not just different colored markers) to represent the treatment and control groups (here's an example: http://tinyurl.com/nakan5r). I can remove the markers and thicken the spikes but I can't figure out how to color the two bars differently. There is an option "separateopts" that seems like it would be able to do this but I can't seem to make it work this way. My command (without the separateops option) is: "devnplot urate0t26, level(0) rspikeopts(lwidth(thick)) separate(txg)". Anyone familiar with this command who might know if this is possible?

    Thanks much!

  • #2
    devnplot is from SSC. I am glad you like it, but I am not developing it further. (See annotation within njc_stuff.sthlp at SSC.) Also separateopts() is just a handle to tune display of the point symbols.

    Better news is that graphs of the kind you want can be developed quite directly from first principles. Here is the result of some doodling.

    Code:
    sysuse auto, clear
    keep if rep78 > 3
    gsort -mpg
    su mpg
    gen level = r(mean)
    gen order = _n
    
    twoway rbar mpg level order if foreign, ///
    bfcolor(red*0.3) blcolor(red) barw(0.85) ///
    || rbar mpg level order if !foreign,  ///
    bfcolor(blue*0.3) blcolor(blue) barw(0.85) ///
    legend(order(1 "Foreign" 2 "Domestic") pos(1) ring(0) col(1)) ///
    ytitle("`: var label mpg'") xsc(r(1, 34)) xla(none) xtitle("")
    Click image for larger version

Name:	avins.png
Views:	1
Size:	34.6 KB
ID:	700173

    Comment

    Working...
    X