Graphics Reference
In-Depth Information
6.4
Controlling legends
This section discusses the use of legends for dot plots, emphasizing the features that are
unique to dot plots. The section
Options : Legend
(287) goes into great detail about legends,
as does [
G
]
legend option
. Legends can be used for multiple
y
-variables or when the first
-variable via the
asyvars
option. See
Dot : Yvars and over
(193) for more information about using multiple
y
over()
variable is treated as a
y
-variables and more examples of treating
the first
over()
variable as a
y
-variable. These following examples use the
vg rose
scheme.
graph dot prev exp tenure ttl exp, over(occ7)
Consider this dot plot of three different
variables. These variables are shown
with different markers, and a legend is
used to identify the variables.
Uses nlsw.dta & scheme vg rose
Prof
Mgmt
Sales
Cler.
Operat.
Labor
Other
0
5
10
15
mean of prev_exp
mean of tenure
mean of ttl_exp
graph dot wage, over(collgrad) over(occ7) asyvars
This is another example of how a
legend can arise in a Stata dot plot if
you use the
over()
variable with the
asyvars
option. Stata treats the levels
of the
over()
variable as if they were
really multiple
Prof
Mgmt
Sales
Cler.
-variables.
Uses nlsw.dta & scheme vg rose
y
Operat.
Labor
Other
0
5
10
15
mean of wage
not college grad
college grad
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.