Hello,
I'm trying to create a rather complicated graph and I am stuck on three last issues (code and resulting graph below and attached):
Thanks so much,
Kate
Here is a link to the image.
Thanks so much!!!
I'm trying to create a rather complicated graph and I am stuck on three last issues (code and resulting graph below and attached):
- I would like to eliminate the blank space on the y axis for the missing values of the categorical variable I do not want to display
- I would like to sort the order of the y-axis variables either manually or by the value of a variable in descending order (hnar_median)
- I would like to include a legend and make the size of the symbol corresponding to the second rbar smaller (where I've made the bar width on the graph scaled to .1)
Thanks so much,
Kate
Code:
tw rbar HNAR_p25 HNAR_p75 nutr_no if data_round==1 /// & inlist(nutr_no,3,4,5,6,8,9,13,14,15,16,22) & scenario==1, horizontal barwidth(.80) /// color(emidblue) fcolor(emidblue) || /// rbar HNAR_p25 HNAR_p75 nutr_no if data_round==1 /// & inlist(nutr_no,3,4,5,6,8,9,13,14,15,16,22) & scenario==2, horizontal barwidth(.1) /// lcolor(green) fcolor(green) /// xline(1, lcolor(black)) ytitle("Nutrient", size(small) margin(1 3 0 0)) /// xtitle("Percent of Nutrient Need Met in Household Diet", size(small) margin(1 1 1 1)) /// xlabel(0 "0" .5 "50%" 1 "100%" 1.5 "150%" 2 "200%") yscale(range(15 6 16 14 5 9 13 22 4 3)) /// ylabel(, val angle(horizontal) labsize(vsmall) nogrid) /// graphregion(color(gs15)) xtitle("2010", size(small) margin(1 1 1 1)) || /// scatter nutr_no HNAR_p50 if data_round==1 & inlist(nutr_no,3,4,5,6,8,9,13,14,15,16,22) & scenario==1, /// mcolor(navy) msymbol(smcircle) msize(*1) ylabel(3 4 5 6 8 9 13 14 15 16 22, val angle(horizontal) labsize(vsmall) nogrid) || /// scatter nutr_no HNAR_p50 if data_round==1 & inlist(nutr_no,3,4,5,6,8,9,13,14,15,16,22) & scenario==2, /// mcolor(dkgreen) msymbol(smcircle) msize(*1) ylabel(3 4 5 6 8 9 13 14 15 16 22, val angle(horizontal) labsize(vsmall) nogrid) || /// scatter nutr_no HNAR_mean if data_round==1 & inlist(nutr_no,3,4,5,6,8,9,13,14,15,16,22) & scenario==1, /// mcolor(navy) msymbol(pipe) msize(*2) ylabel(3 4 5 6 8 9 13 14 15 16 22, val angle(horizontal) labsize(vsmall) nogrid) || /// scatter nutr_no HNAR_mean if data_round==1 & inlist(nutr_no,3,4,5,6,8,9,13,14,15,16,22) & scenario==2, /// mcolor(dkgreen) msymbol(pipe) msize(*2) legend(off)
Thanks so much!!!
Comment