Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

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


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: RE: Different graph height with graph, by()
Date   Wed, 15 Sep 2010 10:19:06 -0500

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 <[email protected]> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index