# Re: st: -graph combine- problem

 From vwiggins@stata.com (Vince Wiggins, StataCorp) To statalist@hsphsun2.harvard.edu Subject Re: st: -graph combine- problem Date Tue, 22 Jul 2008 15:43:43 -0500

```Jeph Herrin <junk@spandrel.net> asks how he can control the aspect ratio of
the resulting graphs when he -graph combines- two graphs,

> I have pairs of graphs; I would like to combine them so each pair is
> in a single graph.
>
> If I -graph combine- with no options, I get two graphs which are
> compressed horizontally, side by side, so they look tall and thin.
> Instead, I would like them side by side but with the same aspect
> ratio as they have pre-combined.
> [...]

With Stata graphs, you specify an overall x- and y-size of the graph and Stata
tries its best to nicely fill that area with your graph.  The main trick to
accomplishing this is to let all of the fixed-size elements -- such as titles,
legends, and axes -- fill the space they require and then let the plotregion
expand or contract to fill the remaining space.  Most of the time this works
nicely and you get pretty results without having to think about the details.

Jeph wants more control.

Jeph can limit the expansion of the plotregion by specifying the
-aspectratio()- option.  When -aspectratio()- is specified, the plotregion
still expands, but stops expanding in either the vertical or horizontal
dimension to retain the specified aspect ratio of the plotregion.  If Jeph
uses this option, he will likely get unwanted space around the combined graphs
in either the horizontal or vertical dimensions.  This happens because Stata
cannot simultaneously honor his aspect ratio request and completely fill the
specified x- and y-size of the combined graph.  Getting rid of the space is
just a matter of specifying either the -xsize()- or -ysize()- option on
-graph combine- to reduce (or expand) one of the dimensions of the combined
graph.

Easier still, unless Jeph requires an absolutely specific aspect ratio, is to
let -graph combine- do what it wants to fill the graph space and control the
aspect ratio by reducing (in Jeph's case) the y-size of the graph.  With
default sizing, Jeph may find that specifying -ysize(2)- on his
-graph combine- command results in subgraphs that are just about right.  That
is to say, that have just about the same aspect ratio as the graphs did before
combining.

Because default font sizes are controlled by the smaller of the width and
height dimensions, and because Jeph now has a fairly squat combined graph, he
may also want to scale up the fonts on the combined graph.  Adding
-scale(1.5)- or -scale(2)- may look better to Jeph.

-- Vince
vwiggins@stata.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```