Graphics Reference
In-Depth Information
graph hbar wage, over(occ7,
sort(occ7alpha)
)
We might want to put these bars in
alphabetical order (but with Other still
appearing last). We can do this by
recoding
occ7
into a new variable (say
occ7alpha
) such that as
occ7alpha
goes from 1 to 7, the occupations are
alphabetical. We recoded
occ7
with
these assignments: 4 = 1, 6 = 2, 2 = 3,
5=4,1=5,3=6,and7=7;see
[
R
]
recode
. Then, the
sort(occ7alpha)
option has the effect
of alphabetizing the bars.
Uses nlsw.dta & scheme vg s2c
Cler.
Labor
Mgmt
Operat.
Prof
Sales
Other
0
2
4
6
8
10
mean of wage
graph hbar wage, over(occ7,
sort(1)
)
Here, we sort the variables on the
height of the bars (in ascending order).
The
sort(1)
means to sort the bars
according to the height of the first
y
Labor
Operat.
Sales
-variable, in this case, the mean of
wage
.
Uses nlsw.dta & scheme vg s2c
Other
Cler.
Prof
Mgmt
0
2
4
6
8
10
mean of wage
graph hbar wage, over(occ7, sort(1)
descending
)
Adding the
descending
option yields
bars in descending order.
Uses nlsw.dta & scheme vg s2c
Mgmt
Prof
Cler.
Other
Sales
Operat.
Labor
0
2
4
6
8
10
mean of wage
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.