Graphics Reference
In-Depth Information
#include s2color // start with the s2color scheme
clockdir legend position
3
// put the legend in the 3 o'clock position
numstyle legend cols
1
// make the legend display in 1 column
yesno legend stacked
yes // stack the keys & symbols on top of each other
gsize legend_key_gap
half_tiny // very, very small gap between key and label
gsize legend_row_gap
small
// somewhat larger gap between key/label pairs
We can then save the file as scheme-legend3.scheme , and we are ready to use it. We
can then use the scheme(legend3) option at the end of a graph command or type set
scheme legend3 , and Stata will use that scheme for displaying our graph. Below, we show
an example using this scheme. (Note that the legend3 scheme is not included among the
downloadable schemes.)
twoway (scatter propval100 rent700) (lfit propval100 rent700),
scheme(legend3)
Here, we see an example using our
newly created legend3 scheme, and
indeed, we see the legend in the 3
o'clock position, in a single column,
with the legend stacked.
Uses allstates.dta & scheme legend3
% homes cost $100K+
Fitted values
0
10
20
30
40
% rents $700+/mo
So far, things are going great. However, note that Stata will only know how to find
the newly created scheme-legend3.scheme while we are working in the directory where we
saved that scheme. If we change to a different directory, Stata will not know where to find
scheme-legend3.scheme . If, however, we save the scheme into our PERSONAL directory,
Stata would know where to find it regardless of the directory we were in. For example, on
my computer, I used the sysdir command, and it showed me the following information:
. sysdir
STATA:
C:\Stata8\
UPDATES:
C:\Stata8\ado\updates\
BASE:
C:\Stata8\ado\base\
SITE:
C:\Stata8\ado\site\
PLUS:
c:\ado\plus\
PERSONAL:
c:\ado\personal\
OLDPLACE:
c:\ado\
From this, I know that my PERSONAL directory is located in c:\ado\personal\ ,soifI
store either .ado files or .scheme files there, Stata will be able to find them. So, if instead
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