Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: stacked and grouped bar charts

From   "Alison K. Levin-Rector" <>
To   "" <>
Subject   st: stacked and grouped bar charts
Date   Tue, 9 Mar 2010 08:58:45 -0800

I'd like to produce a bar graph that is grouped over sex and age and also stacked (avoidable vs unavoidable proportion of death rate). Is there any way to assign different color schemes to the bars for males and females in this graph?  Right now, all of the bars have the same color scheme (green for unavoidable and blue for avoidable deaths), but I would like those to differ by the first over() group. Any advice is greatly appreciated!

graph bar unavoidable arod_all if agecat>=40 & agecat<=65, ///
     over(sex,gap(5) label(angle(45)) ) over(agecat) graphregion(fcolor(white)) stack ///
     legend(label(1 "Avoidable") label(2 "Unavoidable") pos(10) ring(0) col(1) size(small) symxsize(5)) ///
     bar(1, color(green)) bar(2, color(ebblue)) ///
     text(-.075 50 "Age")

Thank you,

Alison Levin-Rector
Post-Bachelor Fellow
Institute for Health Metrics and Evaluation

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index