Graphics Reference
In-Depth Information
-axis. However, Stata
gives you tremendous flexibility in the placement of the legend. We now consider options
that control the placement of the legend, along with options useful for controlling the place-
ment of the items within the legend. The following examples use the vg blue scheme.
As you can see, the default placement for the legend is below the
x
graph bar wage, over(occ7) asyvars legend(position(1))
We can use the legend(position(1))
option to place the legend in the top
right corner of the graph. The values
you supply for position() are like the
numbers on a clock face, where 12
o'clock is the top, 6 o'clock is the
bottom, and 0 represents the center of
the clock face. Specifying 1 o'clock
places the legend in the top right; see
Styles : Clockpos (330) for more details.
Uses nlsw.dta & scheme vg blue
Prof
Mgmt
Sales
Cler.
Operat.
Labor
Other
10
8
6
4
2
0
graph bar wage, over(occ7) asyvars legend(position(1) ring(0) )
Adding the ring(0) option, we can try
to tuck the legend inside the top right
corner of the plot area. Think of the
ring() option as specifying concentric
rings around the graph, where 0 is a
position inside the plot region, 1 is just
outside the plot region, and increasing
values are farther and farther from the
center of the plot region. Unfortunately,
the legend touches one of the bars, but
we will fix that in the next example.
Uses nlsw.dta & scheme vg blue
Prof
Mgmt
10
Sales
Cler.
Operat.
Labor
Other
8
6
4
2
0
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.
Search WWH ::




Custom Search