-
Notifications
You must be signed in to change notification settings - Fork 43
Description
There were issues with the code for stata fundamentals II line 220-250 in Stata 14, issue was not replicated in Stata 15. Color options were not available.
Code Below:
*** More Advanced Plotting Options ***
*What if we want to put two histograms on the same plot?
**Two histograms in one
twoway (histogram wage if union==1) ///
(histogram wage if union==0)
*Hard to differentiate the bars
*Lets add some color differences and add a legend
twoway (histogram wage if union==1, color(blue)) ///
(histogram wage if union==0) , legend(order (1 "Union" 2 "Non-Union"))
*Lets change the opacity of the bars
twoway (histogram wage if union==1, fcolor(blue%50) lcolor(black)) ///
(histogram wage if union==0, fcolor(red%50) lcolor(black)), ///
legend(order (1 "Union" 2 "Non-Union"))
*Change the y axis to percentage
twoway (histogram wage if union==1, percent fcolor(blue%50) lcolor(black)) ///
(histogram wage if union==0, percent fcolor(red%50) lcolor(black)), ///
legend(order (1 "Union" 2 "Non-Union"))
*Line up bars and add a title
twoway (histogram wage if union==1, percent fcolor(blue%50) lcolor(black) start(1) width(2)) ///
(histogram wage if union==0, percent fcolor(red%50) lcolor(black) start(1) width(2)), ///
legend(order (1 "Union" 2 "Non-Union")) title("Wage by Union Status")