Graphics Reference
In-Depth Information
twoway scatter (borninstate propval100 ownhome),
by(nsw,
legend(pos(12))
)
legend(label(1 "Born in state") label(2 "% > 100K"))
Here, we use both of the options from
the previous two graphs, and the
legend()
option is used twice: inside
the
by()
option to modify the position
and outside the
by()
option to modify
its contents. The use of
legend()
with
the
by()
option is covered more
thoroughly in
Options : Legend
(287).
Uses allstatesdc.dta & scheme vg brite
Born in state
% > 100K
North
South
50
60
70
80
West
50
60
70
80
% who own home
Graphs by Region North, South, or West
twoway scatter ownhome borninstate,
by(north,
title("% own home" "by % born in state")
)
title("Region of state")
We can use the
title()
option on its
own to make a title that is displayed
with each graph, and the
title()
option within the
by()
option to make
an overall title.
Uses allstatesdc.dta & scheme vg brite
% own home
by % born in state
Region of state
Region of state
S & W
North
20
40
60
80
20
40
60
80
% born in state of residence
Graphs by Region North or Not
twoway scatter ownhome borninstate,
by(north, total
rescale ixtitle iytitle b1title("") l1title("")
)
Here, we obtain separate graphs for the
three groups, using
rescale
to obtain
different
S & W
North
-axis labels and scales,
ixtitle
and
iytitle
to title the
graphs separately, and
b1title()
and
l1title()
to suppress the overall titles
for the
x
-and
y
20
40
60
80
40
50
60
70
80
% born in state of residence
% born in state of residence
-axes.
Uses allstatesdc.dta & scheme vg brite
x
-and
y
Total
20
40
60
80
% born in state of residence
Graphs by Region North or Not
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.