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.

# st: Scaling problem with graphs

 From Andrea Bennett To statalist@hsphsun2.harvard.edu Subject st: Scaling problem with graphs Date Thu, 23 Aug 2012 13:12:13 +0200

```Hi everyone,

I have the following issue with Stata graphs. Combining the below graphs results in the bars of the first graph to be slightly narrower that bars in the graphs 2 and 3. I think the issue is related to me dropping the y-scale from the second graph. Is there a way to make them exactly the same size, e.g. by dealing with the margins?

label define abil 0 "Low ability" 1 "High ability"
label values abil abil

global format "ytitle("Percent", size(large)) ylabel(0(20)100,  labsize(medium)) blabel(bar, format(%3.1f) size(medium)) ysc(r(0 100)) bar(1, color(gs12) lcolor(white) lwidth(thick)) bar(2, color(gs9) lcolor(white) lwidth(thick))"

graph bar Score if treatment==1, bargap(0) legend(span rows(1)) over(abil, axis(off)) \$format asyvars b1title("Control", size(large) margin(large)) graphregion(margin(2 0 6 4)) saving(abil1, replace)
graph bar Score if treatment==2, bargap(0) yscale(off) over(abil, axis(off)) \$format asyvars b1title("Treatment A", size(large) margin(large)) graphregion(margin(0 0 6 4)) legend(off) saving(abil2, replace)
graph bar Score if treatment==3, bargap(0) yscale(off) over(abil, axis(off)) \$format asyvars b1title("Treatment B", size(large) margin(large)) graphregion(margin(0 0 6 4)) legend(off) saving(abil3, replace)

grc1leg abil1.gph abil2.gph abil3.gph, position(6) ring(1) rows(1) altshrink iscale(*1.5) legendfrom(abil1.gph) saving(abilfull, replace)

Before you wonder why I chose this approach over the following: graph bar Score, over(abil) over(treatment). I was not able to set different colours for the "abil" bars.

Thank you very much,

Andrea

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