Bookmark and Share

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, is already up and running.

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

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

From   Scott Merryman <>
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'


On Wed, Sep 15, 2010 at 9:16 AM, Friedrich Huebler <> 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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index