Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: AW: stacked and grouped bar charts


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: stacked and grouped bar charts
Date   Tue, 9 Mar 2010 18:19:51 +0100

<> 

It may help to -separate- beforehand:


*************
sysuse auto, clear
separate trunk, by(foreign)
separate mpg, by(foreign)
graph bar  trunk0 trunk1 mpg0 mpg1, ///
over(foreign, label(angle(forty_five))) ///
over(rep78) stack
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Alison K.
Levin-Rector
Gesendet: Dienstag, 9. März 2010 17:59
An: [email protected]
Betreff: st: stacked and grouped bar charts

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!

Code:
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
[email protected]


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index