Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: graph margins (Stata 8)


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: graph margins (Stata 8)
Date   Mon, 03 Feb 2003 17:16:04 -0600

Phil Schumm <[email protected]> tells us,

> I have been putting together a few customized schemes for specific
> types of work that I frequently do, and based on the schemes in the
> distribution the syntax seems pretty straightforward and easy to
> work with.

I am impressed!

The format of the graphics .scheme-files is not currently documented, so Phil
is essentially flying without a net.  We will have documentation on the
.scheme-files, but with all of the options and flexibility in the new graphics
we wanted to be sure that the .scheme-files were stable first.


-------------------------
So what is a scheme file?
-------------------------

At the risk of generating too much interest in files whose format is currently
undocumented, a .scheme-file is a file with a special (but simple) format,
located anywhere along the ado-path, that can specify a host of
characteristics about how a graph looks, see [G] schemes for more information.

To see what you might do with a .scheme-file, try two schemes that are shipped
with Stata.  Type,

      . sysuse nlsw88
      . graph dot wage , over(occupation, sort(1)) scheme(s1rcolor)

This produces a dot-plot with a look reminiscent of the default for Stata 7
graphics.

Now try,

      . graph dot wage , over(occupation, sort(1)) scheme(economist)

which produces a dot-plot with a look reminiscent of the the Economist
magazine (http://www.economist.com)

All of the differences between the two graphs were specified in the
s1rcolor.scheme and economist.scheme files.

For anyone wishing to join Phil in creating .scheme-files, I suggest you look
at 

      s2color.scheme

(type -which s2color.scheme- to find it).  s2color.scheme has the most
complete list of graph characteristics that can be set from a .scheme-file.
Most of the other .scheme-files shipped with Stata 8 simply "#include" this
file and then define the ways in which they differ from s2color.scheme


--------------------
Phil's real question
--------------------

> [...] I haven't been able to figure out, however, is how to control the
> left and top margins of a graph when it is printed.  I used to do
> this under Stata 7 with commands of the form:
>
> translator set gph2ps lmargin 0.75
> translator set gph2ps tmargin 1.10

This has not changed from Stata 7 to Stata 8.  The way a graph is placed alone
on the printed page, as opposed to its own margins when placed on a page with
other content, is still controlled by the -translator- settings, so Phil
should continue to use the commands he listed.

If Phil instead wants to always have more space around the content of his
graph, he could do this my setting the overall margin for the graph, either on
the -graph- command line using the -graphregion(margin())- option, or in a
scheme file using the -margin graph ...- directive.

If he always wants larger margins, Phil might put the following line in his
scheme-file,

       margin graph large

If, on the other hand, he wanted small left and right margins, but larger top
and bottom margins, he might use

       margin graph "2 2 10 10"

where the numbers are each a relativesize, see [R] relativesize.  A relative
size is scaled such that 100 is the smaller of the width or height of the
graph.  Note that what follows -margin graph- can be any valid marginstyle
specifier, that is to say anything accepted by a -margin()- option, see [G]
marginstyle.

Here's to Phil's best laid -scheme-s, may they produce only "promis'd joy",
Robert Burns not withstanding (but somewhat misquoted).


-- Vince
   [email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index