📄 scheme_files.hlp
字号:
{smcl}
{* 29mar2005}{...}
{cmd:help scheme files}
{hline}
{title:Description of scheme file format}
{p 3 3 2}
A {help scheme} specifies the overall look of a graph and is defined by a
scheme file. Each entry in a scheme file specifies the look for a specific
attribute of a specific graph element, such as the color of a symbol or the
size of text.
{p 3 3 2}
This information is provided primarily for those creating their own
graphics schemes. We describe the format of scheme files and the effect
entries in the scheme file have on graphs. For an overview of graphics
schemes, see {help schemes}.
{title:Remarks}
{p 3 3 2}
Remarks are presented under the headings
{hi:1. Creating your own schemes}
{hi:2. What is a scheme-file entry?}
{hi:3. Plot entries}
{hi:4. Composite entries}
{hi:5. Example scheme file}
{hi:6. Suggestions}
{p 3 3 2}
See, {help scheme entries} for the full list of scheme file entry definitions;
but first read the rest of this help file.
{title:1. Creating your own schemes}
{p 3 3 2}
Scheme {it:schemename} is stored in file
{cmd:scheme-}{it:schemename}{cmd:.scheme}.
For example, scheme {bf:{help scheme_s2:s2color}} is stored in file
{cmd:scheme-s2color.scheme}. You can find where a scheme file is located by
typing
{cmd:. which} {cmd:scheme-}{it:schemename}{cmd:.scheme}
{p 3 3 2}
To create a new scheme, say {cmd:mine}, you need only create a file with
the name {cmd:scheme-mine.scheme} in your PERSONAL directory (see
{helpb sysdir}). You should always base your scheme on a scheme shipped with
Stata or on another scheme based on an official scheme shipped
with Stata. You do that by putting the line
{p 8 8 0}{cmd:#include {it:schemename}}
{p 3 3 2}
before any scheme-file entries in your scheme. If you want to base your
scheme on the scheme Stata uses by default when shipped, the line should
read
{p 8 8 0}{cmd:#include s2color}
{p 3 3 2}
Graphs drawn with your scheme will start out looking just like those drawn
with {cmd:s2color}, and the entries that you make in your scheme file will
serve as edits to the {cmd:s2color} scheme.
{p 3 3 2}
For the adventurous, that may be sufficient information. Look at the file
containing the {cmd:s2color} scheme {c -} type
{cmd:which scheme-s2color.scheme} to locate that file. You will find the
lines in the file very readable, and you can often guess what effect a line
has. When you want to change something, simply create a similar line in your
own file and change the {it:style} (the last word on the line) to whatever
you prefer; for example, for a {cmd:color} entry change {cmd:green} to {cmd:red}.
For the less adventurous, read on.
{title:2. What is a scheme-file entry?}
{p 3 3 2}
Each entry in a scheme file specifies how a particular attribute of a
graph element looks. For example,
{cmd:symbolsize matrix medium}
{p 3 3 2}
specifies that the size of symbols used in scatterplot matrices is to be
{cmd:medium}. We know this because the first word of the entry specifies the
styletype, or attribute affected; the second word is the graph element, or
the part affected (here {cmd:matrix} is short for scatterplot matrix); and
the third word is the style to be applied to the specific attribute of the
element.
{p 3 3 2}
We could change {cmd:medium} to {cmd:small} or {cmd:large} or any of the
predefined styles for {help markersizestyle}, or we could specify a number for
the size. This number is scaled so that 100 represents the full height of the
graph (or width if the width is smaller than the height); see
{help relativesize}. The available options for each style that may be
specified, the 3rd word, are documented in the tables of entries in
{help scheme entries}.
{p 3 3 2}
As a second example, we could change the text color for axis titles from
{cmd:black} to {cmd:red} by changing the line,
{cmd:color axis_title black}
{p 3 3 2}
to{p_end}
{cmd:color axis_title red}
{p 3 3 2}
The available styles for {cmd:color} entries are the {it:colorstyles}, which
include explicit RGB values, rather than just named colors; see
{help colorstyle} for more information and a discussion of
RGB values. This means that we could have changed the entry to
{cmd:color axis_title "255 0 0"}
{p 3 3 2}
a bright red. Note that the RGB values and any style using more than one
token or word must be enclosed in quotes.
{title:3. Plot entries}
{p 3 3 2}
In addition to standard entries, scheme files have many entries for plots.
{p 3 3 2}
What is a plot? When you type
{cmd:. scatter y1 y2 x}
{p 3 3 2}
the set of plotted markers for y1 versus x is the first plot and y2 versus x
is the second plot. The markers for the first plot look different from those
for the second plot {c -}, with perhaps different colors, or sizes, or both. With
different graph commands, we might have two lines that differ, or two sets of
bars, or two pie slices, but in all cases we refer to these as plot1 and plot2,
and their looks are controlled by {it:pstyles} (short for plot styles); see
{help pstyle}. The official scheme files have entries for 15 plots.
{p 3 3 2}
An entry to set the marker size for the second plot might be
{cmd:symbolsize p2 medium}
{p 3 3 2}
where {cmd:p2} specifies plot2.
{p 3 3 2}
As it turns out, most of Stata's official schemes use the same size markers
for all plots. Rather than having 15 entries to set the same marker size, we
simply omit the plot number and use the following single entry that applies
to all plots:
{cmd:symbolsize p medium}
{p 3 3 2}
We saw earlier how to base your own scheme on another scheme, such as the
official {bf:{help scheme_s2:s2color}} scheme, and in that case we must take some
care using just {cmd:p}. Since {cmd:s2color} defines only one symbolsize for
all plots, we could change the size of all symbols to {cmd:large} by adding
the line
{cmd:symbolsize p large}
{p 3 3 2}
If {cmd:s2color} had been more specific and included entries to separately
define marker sizes for plot1 - plot15, then those more specific entries would
take precedence over our entry that did not specify a plot number. We would
need to make individual entries for {cmd:p1}, {cmd:p2}, etc., for each plot.
{p 3 3 2}
Note that there are many attributes for plot elements, so there are
many plot entries. In addition to marker size, there are entries for marker
color,
{cmd:color p1 navy}
{p 3 3 2}
marker symbol (shape),
{cmd:symbol p circle}
{p 3 3 2}
and sets of entries for lines, boxes, and other plot elements.
{p 3 3 2}
We pulled these two examples from the {cmd:s2color} scheme, and you can see
that the marker colors are different for each plot, whereas the marker symbols
are all circles.
{p 3 3 2}
Plot entries can be even more specific than plot number. Some entries can be
directed at a particular kind of plot. For example, the entry
{cmd:color p3line yellow}
{p 3 3 2}
will make the third line plot yellow but will not affect the color of scatters,
bars, or other plot types. While the {cmd:s2color} scheme does not take
advantage of this, you can create schemes with different colors and
intensities for each plot type {c -} scatter, line, bar, pie slice, etc.
{title:4. Composite entries}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -