Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Friedrich Huebler <fhuebler@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Different graph height with graph, by() |

Date |
Wed, 15 Sep 2010 15:29:55 -0400 |

Thank you, Scott, this looks very promising. One problem is that there are large areas between the combined graphs. This is most apparent when a ysize() option is added to the combined graph, as shown below. I experimented with graphregion(), plotregion() and imargin() without success. I also found no information in the documentation for -graph combine- on how to remove these empty areas. Friedrich sysuse auto, clear local var rep78 levelsof `var',local(levels) foreach l of local levels { qui sum mpg if `var' == `l' local a`l' = ceil(r(mean)) disp `a`l'' local suma = `suma' + `a`l'' } foreach l of local levels { local grsize`l' = (`a`l''/`suma')*100 disp `grsize`l'' } foreach l of local levels { graph bar mpg if `var' == `l', /// name(gr`l', replace) fysize(`grsize`l'') local name "`name' gr`l'" } graph combine `name', cols(1) ysize(10) graph drop `name' On Wed, Sep 15, 2010 at 11:19 AM, Scott Merryman <scott.merryman@gmail.com> wrote: > I am not sure if the absolute distance is the same, but here is one attempt: > > local var rep > levelsof `var',local(levels) > > foreach l of local levels { > qui sum mpg if `var' == `l' > local a`l' = ceil(r(mean)) > disp `a`l'' > local suma = `suma' + `a`l'' > } > > foreach l of local levels { > local grsize`l' = (`a`l''/`suma')*100 > disp `grsize`l'' > } > > foreach l of local levels { > graph bar mpg if `var' == `l', /// > name(gr`l', replace) fysize(`grsize`l'') > local name "`name' gr`l'" > } > > graph combine `name' , cols(1) > > graph drop `name' > > > Scott > > On Wed, Sep 15, 2010 at 9:16 AM, Friedrich Huebler <fhuebler@gmail.com> wrote: >> Thank you, Kieran. Your commands produce the kind of graph I have in >> mind. How did you obtain the values for the fysize() option? How would >> one identify the right fysize() values for a graph with more >> by-groups, as in the example below? Is this a matter of trial and >> error? >> >> graph bar mpg, by(rep78, col(1)) ysize(10) >> >> Friedrich * * 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/

**References**:**st: Different graph height with graph, by()***From:*Friedrich Huebler <fhuebler@gmail.com>

**st: RE: Different graph height with graph, by()***From:*"Kieran McCaul" <Kieran.McCaul@uwa.edu.au>

**Re: st: RE: Different graph height with graph, by()***From:*Friedrich Huebler <fhuebler@gmail.com>

**Re: st: RE: Different graph height with graph, by()***From:*Scott Merryman <scott.merryman@gmail.com>

- Prev by Date:
**Re: st: RE: multiple imputation** - Next by Date:
**Subject: st: Is it necessary to have some variable for exposure in xtnbreg** - Previous by thread:
**Re: st: RE: Different graph height with graph, by()** - Next by thread:
**RE: st: RE: Different graph height with graph, by()** - Index(es):