Feb 11, 2017

Random graphs (93): Bold letters to label panels of a figure

// Read in data for Panel A
clear
input str30 time str30 sex swlb
"Marginal part-time" "Men" 7.0600364
"Marginal part-time" "Women" 7.25796249
"Substantial part-time" "Men" 6.870697962
"Substantial part-time" "Women" 6.885557977
"Full-time" "Men" 6.46086536 
"Full-time" "Women" 6.20409318
end

// Create Panel A
graph bar swlb, over(sex) over(time, sort(1)) ///
      ytitle("Predicted Satisfaction with" "the Work-Life Balance") ///
      xsize(6)  exclude0 ///
      yscale(range(6 7.4)) ylabel(6 (.2) 7.4, format(%6.1f)) ///
      title("{bf:A}", justification(left) bexpand span) ///
      name(A, replace) 

// Read in data for Panel B
clear
input str30 time str30 giis swlb
"Substantial part-time" "High gender equality" 7.172238806
"Substantial part-time" "Low gender equality" 6.292988109 
"Marginal part-time" "High gender equality" 7.357329866
"Marginal part-time" "Low gender equality"  6.843323499
"Full-time" "High gender equality" 6.435347496
"Full-time" "Low gender equality" 6.143352232
end

// Recode one variable so that categories are in right order
generate gii = 0 if giis == "Low gender equality"
replace  gii = 1 if giis == "High gender equality"
label define gii 0 `""Low" "gender" "equality""' ///
                 1 `""High" "gender" "equality""'
label val gii gii
drop giis

// Create Panel B
twoway (line swlb gii if time == "Marginal part-time") ///
       (line swlb gii if time == "Substantial part-time") ///
       (line swlb gii if time == "Full-time") ///
      , legend(order(1 "Marginal part-time" 2 "Substantial part-time" 3 "Full-time") pos(2)) ///
        ytitle("Predicted Satisfaction with" "the Work-Life Balance") ///
        xlabel(0 1, val) xtitle("") ///
        ylabel(6 (.2) 7.4, format(%6.1f)) ///
        name(B, replace) ///   
        title("{bf:B}", justification(left) bexpand span)

// Combine Panel A and Panel B
graph combine A B, row(2) ysize(8) xsize(6) ycommon