Skip to content

Color Option Errors in Stata 14 #14

@melaniephillips

Description

@melaniephillips

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions