Hello,
I've created the following dataset for the purpose of this question:
I've created a horizontal bar chart (stacked) for the variable apple with the following code:
My first question is:
1. Is it possible to center responses around 0, i.e. "Strongly disagree" and "Disagree" on the left hand side of the axis and "Agree" and "Strongly agree" on the right-hand side of the axis? That means the scale would be [-100;100] instead of [1;100].
Secondly, the ultimate goal is to create two subgraphs (one for female==0, the other for female==1). Each graph should depict the distribution of responses for the five variables apple, orange, banana, carrot and tomato (below each other), separate by treatment group for each variable.
So two further questions would be:
2. For the two subgraphs, is there a way without using graph combine? To my understanding, twoway does not work here.
3. I'm unable to include all five variables into one graph, particulary due to the fact that the response scales are not the exact same for all variables.
Thank you!!
I've created the following dataset for the purpose of this question:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(female treatment apple orange banana carrot tomato) 0 0 1 3 2 1 1 0 0 3 3 3 1 2 0 0 2 2 2 2 1 0 0 3 4 2 2 2 0 0 2 1 4 2 1 0 0 4 2 1 2 2 0 0 3 3 2 1 2 0 1 2 4 3 2 2 0 1 3 2 2 1 1 0 1 2 3 4 1 2 0 1 4 4 2 2 1 1 0 1 1 3 1 1 1 0 2 2 2 1 1 1 0 3 3 3 2 2 1 0 4 2 2 2 1 1 0 2 3 3 2 2 1 1 3 2 1 1 1 1 1 2 4 2 2 2 1 1 4 2 3 1 1 1 1 2 1 2 2 2 end label values apple scale14 label values orange scale14 label values banana scale14 label def scale14 1 "Strongly disagree", modify label def scale14 2 "Disagree", modify label def scale14 3 "Agree", modify label def scale14 4 "Strongly agree", modify label values carrot scale12 label values tomato scale12 label def scale12 1 "no", modify label def scale12 2 "yes", modify
Code:
graph hbar, ///
over(apple) ///
over(treatment) over(female) ///
stack asyvars percentage ///
graphregion(margin(vsmall) color(gs15)) ///
bar(1, fintensity(100) fcolor(blue%75) lcolor(blue%75) lwidth(thin)) ///
bar(2, fintensity(100) fcolor(blue%55) lcolor(blue%55) lwidth(thin)) ///
bar(3, fintensity(110) fcolor(blue%25) lcolor(blue%25) lwidth(thin)) ///
bar(4, fintensity(100) fcolor(green%55) lcolor(green%55) lwidth(thin)) ///
bar(5, fintensity(110) fcolor(green%75) lcolor(green%75) lwidth(thin)) ///
title("I like apples", fcolor(gs15) pos(12) bexpand size(10.5pt)) ///
subtitle(" ") legend(label(1 "Strongly disagree") label(2 "Disagree") label(3 "Agree") label(4 "Strongly agree"))
1. Is it possible to center responses around 0, i.e. "Strongly disagree" and "Disagree" on the left hand side of the axis and "Agree" and "Strongly agree" on the right-hand side of the axis? That means the scale would be [-100;100] instead of [1;100].
Secondly, the ultimate goal is to create two subgraphs (one for female==0, the other for female==1). Each graph should depict the distribution of responses for the five variables apple, orange, banana, carrot and tomato (below each other), separate by treatment group for each variable.
So two further questions would be:
2. For the two subgraphs, is there a way without using graph combine? To my understanding, twoway does not work here.
3. I'm unable to include all five variables into one graph, particulary due to the fact that the response scales are not the exact same for all variables.
Thank you!!

Comment