Graphics Reference
In-Depth Information
5.3
Controlling the categorical axis
This section describes ways that you can label categorical axes. Box plots are similar
to bar charts, but they are different from other graphs because their
-axes are repre-
sented by categorical variables. This section describes options you can use to customize
these categorical axes. For more details on this, see [
G
]
cat axis label options
and
[
G
]
cat axis line options
.
x
We will start by showing examples of how you can change the labels for the
x
-axis for
these categorical variables. The next set of examples will use the
vg teal
scheme.
graph box wage, nooutsides over(south)
This is an example of a box plot with
one
over()
variable graphing wages
broken down by whether one lives in
the South. The variable
south
is a
dummy variable that does not have any
value labels, so the
20
15
-axis is not labeled
very well. We use the
nooutsides
option to suppress the display of
outside values. For the rest of the
graphs in this section, there would be a
large number of outside values, which
would make the graphs very cluttered,
so we will include the
nooutsides
option for each example.
Uses nlsw.dta & scheme vg teal
x
10
5
0
0
1
excludes outside values
graph box wage, nooutsides over(south,
relabel(1 "N & W" 2 "South")
)
We can use the
relabel()
option to
change the labels displayed for the
levels of
south
, giving the
20
-axis more
meaningful labels. Note that we wrote
relabel(1 "N & W")
,not
relabel(0
"N & W")
, since these numbers do not
represent the actual levels of
south
but
the ordinal position of the levels, i.e.,
first and second.
Uses nlsw.dta & scheme vg teal
x
15
10
5
0
N & W
South
excludes outside values
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.