Last active
March 3, 2016 16:29
-
-
Save vikjam/d4c8f22703d208304e18 to your computer and use it in GitHub Desktop.
Plotting histogram with line graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webuse nlswork, clear | |
gen count_ln_wage = !missing(ln_wage) | |
collapse (sum) count_ln_wage (mean) ln_wage, by(grade year) | |
label var count_ln_wage "Number of individuals" | |
label var ln_wage "Average log(wage)" | |
levelsof year, local(years) | |
foreach yr of local years { | |
graph twoway (bar count_ln_wage grade, yaxis(2)) (line ln_wage grade, yaxis(1) connect(stairstep)) if year == `yr', title("`yr'") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment