Graphics Reference
In-Depth Information
10.6
Line patterns
We can specify the pattern we want for a line in three ways. We can specify a word that
selects among a set of predefined styles, including
solid
(solid line),
dash
(a dashed line),
dot
(a dotted line),
shortdash
(short dashes),
longdash
(long dashes), and
blank
(invisi-
ble). There are also combination styles
dash dot
,
shortdash dot
,and
longdash dot
.We
can also use a formula that combines the following five elements in any way that we wish:
l
(letter l, solid line), (underscore, long dash),
-
(hyphen, medium dash),
.
(period, short
dash), and
#
(small amount of space). We could specify
longdash dot
or
" ."
, and they
would be equivalent. See [
G
]
linepatternstyle
for more information.
twoway (line close tradeday,
clpattern(solid)
sort)
(lfit close tradeday,
clpattern(dash)
)
(lowess close tradeday,
clpattern(shortdash dot)
)
In this example, we make a line plot
and use the
clpattern()
(connect line
pattern) option to obtain a solid
pattern for the observed data, a dash
for the linear fit line, and a short dash
and dot line for a lowess fit.
Uses spjanfeb2001.dta & scheme vg s2c
0
10
20
30
40
Trading day number
Closing price
Fitted values
lowess close tradeday
twoway (line close tradeday,
clpattern("l")
sort)
(lfit close tradeday,
clpattern(". ")
)
(lowess close tradeday,
clpattern("-###")
)
We can use the
clpattern()
option
specifying a formula to indicate the
pattern for the lines. Here, we specify a
solid line for the
line
plot, a dot and
dash for the
lfit
plot, and a dash and
three spaces for the
lowess
fit.
Uses spjanfeb2001.dta & scheme vg s2c
0
10
20
30
40
Trading day number
Closing price
Fitted values
lowess close tradeday
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.