Showing posts with label stack. Show all posts
Showing posts with label stack. Show all posts

Aug 20, 2015

Random graphs (52): Stacked bar graph


// Source:
// Kupka, Markus S., Anna Pia Ferraretti, Jacques De Mouzon, Karin Erb, Thomas
//     D'Hooghe, José Antonio Castilla, Carlos Calhaz-Jorge, Christian De
//     Geyter, Veerle Goossens, and the European IVF Monitoring Consortium for
//     the European Society of Human Reproduction and Embryology. 2014.
//     "Assisted Reproductive Technology in Europe, 2010. Results Generated from
//     European Registers by ESHRE." Human Reproduction 29(10):2099-2113. doi:
//     10.1093/humrep/deu175

clear
input str20 cntry ivf icsi fer pgd ed ivm for
"Belgium"  15.9 46.0 30.9 2.2 5.0 0.0 0.0 100.0
"Denmark"  41.6 35.1 21.1 0.8 1.4 0.0 0.0 100.0
"Germany"  15.3 56.2 28.6 0.0 0.0 0.0 0.0 100.0
"United Kingdom" 37.0 40.1 18.1 1.2 3.3 0.1 0.1 100.0
"Italy"   14.9 74.5 6.4 0.0 0.0 0.0 4.1 100.0
"Spain"   5.9 49.5 14.9 4.7 22.0 0.0 3.1 100.0
"Slovenia"  27.9 53.7 17.2 0.8 0.4 0.0 0.0 100.0
"Czech Republic" 15.4 49.6 22.9 2.4 9.7 0.0 0.0 100.0
end



graph hbar ivf icsi fer pgd ed for, over(cntry, sort(ivf) desc) stack ///
      legend(label(1 "IVF") label(2 "ICSI") label(3 "FER") ///
      label(4 "PGD") label(5 "ED") label(6 "FOR") pos(12) row(1)) ///
      ytitle("Percentage of all ART treatments, 2010") name(figure2, replace) ///
   scheme(lean1)

Oct 2, 2014

Random graphs (31): Stacked bar graph

// Read in data
input str50 mainfield men women
"Engineering and manufacturing" 0.8114392 0.1885608
"Agriculture and veterinary" 0.6366048 0.3633952
"Science, math, and computing" 0.5956416 0.4043584
"Unknown" 0.4658494 0.5341506
"General" 0.4364162 0.5635838
"Service" 0.4277022 0.5722978
"Arts and humanities" 0.3742812 0.6257188
"Social, business, and law" 0.3351495 0.6648505
"Education" 0.2417112 0.7582888
"Health and welfare" 0.1602837 0.8397163
end

// Convert to percentage
replace women = women * 100
replace men = men * 100

// 
graph hbar men women, over(mainfield, sort(women)) ///
                      legend(order(1 "Men" 2 "Women") pos(6) row(1)) ///
                      stack ///
                      ytitle("%") yalternate