# Re: st: RE: graph plot region size control

 From Laura Gibbons To statalist@hsphsun2.harvard.edu Subject Re: st: RE: graph plot region size control Date Wed, 7 Nov 2007 14:47:41 -0800 (PST)

Nick and Maartin rightfully took me to task for giving up without explaining my actual goal. I apologize and appreciate your continued interest.

I am trying to make (a series of) graphs that are the same size, where the plot regions are also the same size. Because the lengths of the labels vary, the plot regions are adjusted by Stata and I have no way to control them directly. It's not wrong, but it makes quick comparisons more difficult. Below is the type of graph I need to make. The values for yline will vary between graphs. Note that in this public example, price and weight measure different things, so it would seem silly to try to compare them, but in my real graphs, the variables are on the same scale, and I set the x axis to be the same range in all graphs.

---------
use http://www.stata-press.com/data/r10/auto

graph hbox price, over(foreign) yline(4000 8000) xsize(3.25) ysize(2.375)
graph export f1.wmf, replace

graph hbox weight, over(rep78) yline(2000 3000) xsize(3.25) ysize(2.375)
graph export f2.wmf, replace
--------

Though the overall sizes are the same, the plot region in f2 is larger because the labels are shorter.

Since I last emailed, I have figured out how to improve things with the relabel option (below). Probably if I used a fixed (monospace) font or added more spaces I could get pretty close. But if there is a way to do this with by() or twoway, I'd love to learn it. And I would like there to be an option to set the plot region size.

---------
graph hbox weight, over(rep78, ///
relabel(1 " 1" 2 " 2" 3 " 3" 4 " 4" 5 " 5")) ///
yline(2000 3000) xsize(3.25) ysize(2.375)
graph export f3.wmf, replace
---------

Thanks for any advice you may have, and for keeping me honest!
-Laura

On Wed, 7 Nov 2007, Maarten buis wrote:

```--- Laura Gibbons <gibbonsl@u.washington.edu> wrote:
```
```Unfortunately my graphs are more complicated than the bar graphs in
the original post, so by() isn't an alternative.  But if I could
control the  size of the plot region, I'd be home.  It looks like I
need to settle for  uneven plot region sizes or use a different
graphing program, and neither  option is appealing.
```
```I can tell from experience that a surprising lot can be done with
-by()-, even in very very complicated graphs (though you may need to
use some tricks). So my gues is that you can do this with -by()- and
thus save you a lot of trouble. If you don't tell us in what way your
graphs are so complicated I cannot give you more advise than this very
vague encouragement to have another good look at the by option.

-- Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
*
*   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/

```
```~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780
Harborview Medical Center
325 Ninth Avenue, Seattle, WA  98104

phone: 206-744-1842   fax: 206-744-9917