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]

st: Margins not aligned for stacked hbar grc1leg


From   kavita sardana <[email protected]>
To   [email protected]
Subject   st: Margins not aligned for stacked hbar grc1leg
Date   Thu, 14 Mar 2013 14:16:37 +0530

I am combining 5 stacked hbar graphs. For the last hbar graph, for age
group "above 65", margins are not aligned. Will appreciate any help on
this.


clear all

input str25 q a1 a2 a3 a4 a5

"18-24" 14.29 52.63 26.32 6.77 0.00

"25-34" 9.04 65.96 23.40 1.60 0.00

"35-44" 10.67 54.49 33.15 0.56 1.12

"45-54" 9.01 67.57 22.52 0.90 0.00

"55-64" 10.29 61.76 23.53 4.41 0.00

"above 65" 0.00 69.23 30.77 0.00 0.00

end

graph hbar a1-a5 if q=="18-24", percent over(q, label (labsize(tiny))
gap(20)) blabel(bar, format(%3.2f) position(center)) ytitle("Age") ///

stack legend(off) yscale(off) yline(20 40 60 80 ,lwidth(0.25) lcolor(black)) ///

saving(a1, replace)yscale(off) plotregion(margin( b+1 t+1)) outergap(50)



graph hbar a1-a5 if q=="25-34", percent over(q, label (labsize(tiny))
gap(20)) blabel(bar, format(%3.2f) position(center)) ytitle("Age") ///

stack legend(off) yscale(off) yline(20 40 60 80 ,lwidth(0.25)lcolor(black)) ///

saving(a1a, replace)yscale(off) plotregion(margin( b+1 t+1)) outergap(50)



graph hbar a1-a5 if q=="35-44", percent over(q, label (labsize(tiny))
gap(20)) blabel(bar, format(%3.2f) position(center)) ytitle("Age") ///

stack legend(off) yscale(off) yline(20 40 60 80 ,lwidth(0.25) lcolor(black)) ///

saving(a1b, replace)yscale(off) plotregion(margin( b+1 t+1)) outergap(50)



graph hbar a1-a5 if q=="45-54", percent over(q, label (labsize(tiny))
gap(20)) blabel(bar, format(%3.2f) position(center)) ytitle("Age") ///

stack legend(off) yscale(off) yline(20 40 60 80 ,lwidth(0.25)lcolor(black)) ///

saving(a1c, replace)yscale(off) plotregion(margin( b+1 t+1)) outergap(50)



graph hbar a1-a5 if q=="55-64", percent over(q, label (labsize(tiny))
gap(20)) blabel(bar, format(%3.2f) position(center)) ytitle("Age") ///

stack legend(off) yscale(off) yline(20 40 60 80 ,lwidth(0.25) lcolor(black)) ///

saving(a1d, replace)yscale(off) plotregion(margin( b+1 t+1)) outergap(50)



graph hbar a1-a5 if q=="above65", percent over(q,label (labsize(tiny))
gap(40)) blabel(bar, format(%3.2f) position(center)) ytitle("Age") ///

stack legend(span rows(1) label(1 "No Change") label(2 "Better") ///

label(3 "Worse") label(4 "No direct experience") label(5 "Dont know") ///

size(tiny)) ///

yline(20 40 60 80 ,lwidth(0.25 ) lcolor(black)) saving(a2, replace)

grc1leg a1.gph a1a.gph a1b.gph a1c.gph a1d.gph a2.gph, cols(1) ///

imargin(0 0 0 0) xcommon legendfrom(a2.gph)


exit
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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