Hi there, I am plotting a percent histogram using a variable, impact, with 5 discrete categories, by another indicator variable, com. I am trying to colour each of the 5 bars individually: 1 red, 2 orange, 3 grey, 4 yellow, 5 green. I have tried plotting 5 different histograms and overlaying them, however, all the bars then read 100% and I am unable to use -cols(1)-. I would be grateful for some help!
Here is some example data:
impact com
1 0
3 0
2 1
1 0
1 1
4 0
5 0
2 0
2 1
2 1
5 1
4 1
5 0
5 1
4 0
3 1
2 0
2 1
3 1
3 0
4 0
1 0
1 1
5 0
5 1
3 0
3 1
4 0
4 1
2 1
Here is my code:
twoway histogram impact, percent by(com, cols(1)) discrete width(0.5) xlabel(1(1)5, valuelabel)
Here is some example data:
impact com
1 0
3 0
2 1
1 0
1 1
4 0
5 0
2 0
2 1
2 1
5 1
4 1
5 0
5 1
4 0
3 1
2 0
2 1
3 1
3 0
4 0
1 0
1 1
5 0
5 1
3 0
3 1
4 0
4 1
2 1
Here is my code:
twoway histogram impact, percent by(com, cols(1)) discrete width(0.5) xlabel(1(1)5, valuelabel)
Comment