⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scheme_files.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
📖 第 1 页 / 共 2 页
字号:

{p 3 3 2}
When we said that each entry specifies a particular attribute, that was an
oversimplification.  Some entries designate how the specific attributes will be
assigned for a collection of attributes for a graph element.  We will call the
entries for these collections composite entries.

{p 3 3 2}
Textboxes, for example, are used for titles, captions, and many other graph
text elements.  There are 11 attributes associated with a textbox, e.g., the
size of the text, the color of the text, the color of the background, and
more; see {help textboxstyle} for the full list.  Changing a
{it:textboxstyle} entry, which is a composite entry, can potentially change
all 11 of these attributes.

{p 3 3 2}
Let's look at two composite entries for textboxstyles:

	{cmd:textboxstyle axis_title axis_title}
	{cmd:textboxstyle title      heading}

{p 3 3 2}
The first entry specifies that the {it:textboxstyle} for axis titles is to be
the {cmd:axis_title} style, which seems like a good default.  Similarly, the
second line specifies that the {it:textboxstyle} for graph titles is to be the
{cmd:heading} style.  

{p 3 3 2}
We could make axis titles look just like graph titles by changing the
specified {it:textboxstyle} of the first entry from {cmd:axis_title} to
{cmd:heading}:

	{cmd:textboxstyle axis_title heading}

{p 3 3 2}
Now, all axis titles will look like graph titles {c -} they will have the same
text size, the same text color, etc.

{p 3 3 2}
Note that changes to composite entries can interact with the effects of other
entries.  In section 2, we changed the color of axis title text by changing the
{cmd:color axis_title black} entry to {cmd:color axis_title red}.  Now that
the composite {it:textboxstyle} entry for axis titles no longer specifies the
{cmd:axis_title} style, but rather the {cmd:heading} style, our color change
will have no effect.  We would need to change the {cmd:color heading black}
entry to {cmd:color heading red} to change the color of axis titles.  This
would also change the color of graph titles because the two now share
the {cmd:heading} {it:textboxstyle}.


{title:5. Example scheme file}

{p 3 3 2}
As discussed in section 1, you can create your own schemes by creating a file
in your PERSONAL director called {cmd:scheme-}{it:schemename}{cmd:.scheme}.
Let's look at a very simple example of such a scheme and name the scheme
{cmd:simple}.


	{hline 3} Begin scheme-simple.scheme {hline 24}
	{cmd:#include s2color}
	{cmd:color background  white}
	{hline 3} End scheme-simple.scheme {hline 26}

{p 3 3 2}
This scheme is based on the {bf:{help scheme_s2:s2color}} scheme; and we can
tell that because of the {cmd:#include s2color} line (see section 1). It
changes only one thing -- the background color is set to {cmd:white}.  
If we use {cmd:mine} by including {cmd:scheme(mine)} option on
our graph command (see {help schemes} for more ways to set the scheme), then
the graph region will no longer be bluish gray, but will be white.  Any other
graph element that references the background color will also be white.

{p 3 3 2}
Now, let's look at a slightly more complicated example, which we will call
{cmd:mine}.

	{hline 3} Begin scheme-mine.scheme {hline 26}
	{cmd:* This is our better demonstration scheme.}
	{cmd:* We should probably go on to describe it further here.}

	{cmd:*! version 1.0.0   12nov2004}

	{cmd:#include s2color}

	{cmd:color background  white}
	{cmd:color major_grid  "200 200 200"}

	{cmd:color p1          "  0 255   0"}
	{cmd:color p2          magenta}

	{cmd:anglestyle vertical_tick    horizontal}

	{cmd:clockdir   legend_position  4}
	{cmd:numstyle   legend_cols      1}
	{cmd:linestyle  legend           none}
	{cmd:margin     legend           "5 0 0 0"}
	{hline 3} End scheme-mine.scheme {hline 28}

{p 3 3 2}
The first two lines are simply comments to help us identify our scheme later.
Note that in scheme files, comments can only be entered as entire lines and
the lines must begin with a "*".  The third line is just a fancy comment that
identifies the version number of our scheme and the date it was last updated.

{p 3 3 2}
The line {cmd:#include s2color} includes the entire contents of the official
{cmd:s2color} scheme in our scheme.  Again, this is just the starting point
for our changes.

{p 3 3 2}
As in {cmd:simple}, the line {cmd:color background  white} sets the background
color to white.  Similarly, the line 
{bind:{cmd:color major_grid "200 200 200"}} specifies that grid lines be drawn
in a light shade of gray.  Here we are using an RGB value rather than a named
{help colorstyle}; see section 2.  For more entries relating to grid lines, see
{help scheme grids}.

{p 3 3 2}
The next two entries,

	{cmd:color p1          "  0 255   0"}
	{cmd:color p2          magenta}

{p 3 3 2}
change how the first two plots look.  The first entry changes the color of the
first plot to a bright green using the RGB value {cmd:"0 255 0"}.  Note that
the extra spacing is not required in the RGB value; it is only there to make
the entries align nicely in the file.  The second entry changes the color of
the second plot to magenta using the named {help colorstyle} {cmd:magenta}.

{p 3 3 2}
The {cmd:anglestyle vertical_tick horizontal} entry changes the angle of text
used to label the ticks on the y axis (designated by {cmd:vertical_tick}) to
be {cmd:horizontal} so that they are not turned "sideways" as they are in the
{cmd:s2color} scheme.  See {help scheme axes} for more entries relating to
axes.

{p 3 3 2}
The last four entries change where and how legends are displayed.  The 
{bind:{cmd:clockdir legend_position 4}} entry moves the legend from its
default position at the bottom of the graph to 4 o'clock {c -} the right of the
graph and aligned with the bottom of the graph.  
{bind:{cmd:numstyle legend_cols 1}} changes the default number of columns in
the legend from 2 to 1, while {bind:{cmd:linestyle legend none}} turns off the
outlining around the legend.  Finally, {bind:{cmd:margin legend "5 0 0 0"}},
designates a small margin, {cmd:5}% of the graph size, to the left of the legend
with no margin ({cmd:0}) to the right, top, or bottom.  Find out more about
these entries and other legend settings at {help scheme legends}.

{p 3 3 2}
In 10 lines, we have changed quite a bit about how graphs drawn with our
scheme will look.  You can click {stata scm_mine:here} to create a copy of
{cmd:scheme-mine.scheme} in your current working directory, and then you
can draw some graphs using the new scheme.  For starters try

{p 8 10 0}. {stata sysuse auto}{p_end}
{p 8 10 0}. {stata scatter trunk turn weight, scheme(s2color)}{p_end}
{p 8 10 0}. {stata scatter trunk turn weight, scheme(mine)}{p_end}

{p 3 3 2}
and compare the difference.  Try drawing some other bar graphs or others with
the new scheme.


{title:6. Suggestions}

{p 3 3 2}
The first and best suggestion is to try it.  The base scheme file for graphics, 
{cmd:scheme-s2color.scheme} has over 1,700 entries.  Because composite entries 
often change the effect of other entries (see section 4), the entry 
descriptions in {help scheme entries} at best indicate what 
will happen if you base your new scheme on {cmd:s2color}; if you base it on
another scheme, you may need to experiment to get the desired effects.

{p 3 3 2}
It is also a good idea to build your new scheme in small steps while checking 
the results on a graph.  Draw a graph that has all the elements you want 
to control: perhaps axes, legends, or even the third scatter plot.  Then
create your scheme file and place a {cmd:#include} statement to base your
scheme on an existing scheme.  Now redraw your graph using your new, but
empty, scheme using the the {cmd:scheme({it:your_scheme})} option.  Now add
a single entry to your scheme, issue the {cmd:discard} command, redraw 
the graph by reissuing the graph command, and observe the result.  Then, 
make changes to the entry, if desired; or, move on to the next element you 
want to change.  This is how {cmd:scheme-mine.scheme} was created.  In 
particular, we did not know exactly how all the changes to the legends 
would look, and we altered several entries after seeing the initial results.

{p 3 3 2}
It is critical that you issue the {cmd:discard} command each time before you
reissue your graph command.  {cmd:discard} reinitializes the graphics
system, and that includes clearing the graphics scheme.  If you do not
type {cmd:discard}, {cmd:graph} will note that you are using the
same scheme each time and will use the already loaded scheme {c -} 
ignoring the changes you made in the scheme file.


{title:Also see}

    Manual:  {hi:[G] schemes intro}

{psee}
Online:
{help scheme entries};
{it:{help schemes}},
{it:{help scheme_option}},
{helpb set scheme}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -