Graphics Reference
In-Depth Information
twoway scatter faminc educ
This section focuses on the options that
we can use to select axes and shows
examples of graphing multiple variables
in a single graph. This graph shows the
relationship between one
x
-variable,
educ , and one
-variable, faminc .
Uses allstatesdc.dta & scheme vg outc
y
9.5
10
10.5
11
average education level
twoway (scatter faminc educ, xaxis(1) yaxis(1) )
x
By default, the
-variable is placed on
the first
x
-axis, and the
y
-variable is
placed on the first
-axis. It is as
though you had added the options
xaxis(1) and yaxis(1) , as illustrated
here. Note that we add parentheses to
emphasize that the options xaxis(1)
and yaxis(1) belong to the scatter
command and are not general options
for the overall graph, which would
appear after the parentheses.
Uses allstatesdc.dta & scheme vg outc
y
9.5
10
10.5
11
average education level
twoway (scatter faminc educ)
(scatter workers2 educ)
Now let's overlay a second scatterplot
showing workers2 by educ , which has
the effect of adding a second variable to
the
-axis. Stata assumes that all
variables are on the first (and thus, the
same) axis, unless we specify otherwise.
As a result, this graph is hard to read
because faminc is scaled very
differently from workers2 but scaled on
the same axis.
Uses allstatesdc.dta & scheme vg outc
y
9.5
10
10.5
11
average education level
1979 Median Family Inc.
% HHs with 2+ workers
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