Graphics Reference
In-Depth Information
twoway (scatter faminc educ, yaxis(1) )
(scatter workers2 educ, yaxis(2) )
Stata permits you to have multiple axes
for the
-variables.
In this example, we use the yaxis(1)
option to place faminc on the first
y
x
-variables and the
y
-axis and the yaxis(2) option to
place workers2 on the second
-axis.
To make the graph more readable,
Stata moved the second
y
-axis over to
the right side. Note that the yaxis(1)
option was not needed but was included
for clarity.
Uses allstatesdc.dta & scheme vg outc
y
9.5
10
10.5
11
average education level...
1979 Median Family Inc.
% HHs with 2+ workers
twoway (scatter faminc educ)
(scatter workers2 educ, yaxis(2)), ylabel(40(5)80, axis(2))
Say that you wished to label workers2
starting at 40, incrementing by 5 until
80. Since workers2 is on the second
y
-axis, you would specify
ylabel(40(5)80, axis(2)) . Without
the axis(2) option, Stata would
assume that you are referring to the
first
-axis and would change the
scaling of faminc .
Uses allstatesdc.dta & scheme vg outc
y
9.5
10
10.5
11
average education level...
1979 Median Family Inc.
% HHs with 2+ workers
twoway (scatter faminc educ)
(scatter workers2 educ, yaxis(2) ylabel(40(5)80) )
You might be tempted to enter the
ylabel() option as an option of the
second scatter statement and expect
the ylabel() to modify the scaling of
workers2 . However, we can see in this
example that this does not work.
Uses allstatesdc.dta & scheme vg outc
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