Graphics Reference
In-Depth Information
twoway scatter close tradeday
Consider this graph, which shows the
closing price of the S&P 500 index for
January and February of 2001 by
tradeday , the trading day numbered
from 1 to 40.
Uses spjanfeb2001.dta & scheme
vg blue
1400
1350
1300
1250
0
10
20
30
40
Trading day number
twoway scatter close tradeday, connect(l)
We use connect(l) to connect the
points, but this does not lead to the
kind of graph we really wanted to
create. This is because the observations
in the data file are not sorted according
to tradeday , yet the observations are
connected based on the order in which
they appear in the data file.
Uses spjanfeb2001.dta & scheme
vg blue
1400
1350
1300
1250
0
10
20
30
40
Trading day number
twoway scatter close tradeday, connect(l) sort
If we add the sort option, the
observations are connected after sorting
them by tradeday , which leads to the
kind of graph we wanted to create.
Alternatively, we could have typed
sort tradeday , and all ensuing graphs
would have been ordered on tradeday ,
even without the sort option.
Uses spjanfeb2001.dta & scheme
vg blue
1400
1350
1300
1250
0
10
20
30
40
Trading day number
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