Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: several gr hbar but wants bar of same size


From   "Scott Merryman" <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: several gr hbar but wants bar of same size
Date   Mon, 20 Aug 2007 09:23:17 -0500

On 8/17/07, b. water <barleywater@hotmail.com> wrote:
> dear statalisters,
>
> windows xp pro sp2, stata 8.2,
>
> i am creating a few gr hbar graphs with this syntax:
>
> gr hbar noof if timetest=="varlists", over(test, sort (pos)) ytitle("No. of
> studies") ysc(r(0 35)) ylab(0 (5) 35)
>
> because the varlists are different for each graph, without modifications, i
> ended up with fixed size graphs, but where the bars and axes are squeezed
> (some are difficult to read). i can correct this somewhat with ysize &
> labsize but the results are not aesthetically pleasing because i just could
> not get the right ysize(s) so that i would have consistent relative
> appearances of the e.g. font sizes (of the axes) and the bars. i hope i am
> making sense.

No, or at least not to me.

In the following example:

sysuse auto,clear
graph hbar mpg, over(fore)  name(gr1,replace)
graph hbar mpg, over(rep)  name(gr2,replace)

you would want the bars in the two graphs to be the same size?

One way would be add empty categories so both graphs had the same
number of categories:

sysuse auto,clear
graph hbar mpg, over(fore)  name(gr1,replace)
graph hbar mpg, over(rep)  name(gr2,replace)

set obs 77
replace fore = -5 in 75
replace fore = .5 in 76
replace  fore = 5 in 77

graph hbar mpg, over(fore, relabel( 1 `"" " " ""' 3 `"" " " ""' 5 `""
" " ""'))  ///
 name(gr3,replace)


Scott
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index