Hello everyone,
I have the following questions on graphs, the solutions to which may be very simple.
1. Boxplot: How can I add a label on a yline in the graph region? For example, the yline is 1 and I want a label next to the line saying "Ideal value". Similarly, I have two other ylines and want labels for those as well. I tried several commands but posting the most recent one:
Also, how can I add a title for the x axis? Logically, because ytitle is for y axis, I tried xtitle and it does not work.
2. Scatter plot: Is it possible to make more than 2 scatter plots in one twoway scatter plot? The variables are continuous (energy intake and energy expenditure), which I want to plot based on a categorical variable (with 3 categories: under, normal and over). The codes for the first scatter plot is:
2nd scatter:
So, how can I have both the scatter plots into one? Is combining the scatter the only option (using graph combine)?
Is it also possible to have a lfit lines for the scatter plots?
I have the following questions on graphs, the solutions to which may be very simple.
1. Boxplot: How can I add a label on a yline in the graph region? For example, the yline is 1 and I want a label next to the line saying "Ideal value". Similarly, I have two other ylines and want labels for those as well. I tried several commands but posting the most recent one:
Code:
graph box Ratio, over(desc) /// title("Figure: EI and EER", size(medium)) /// ytitle ("EI:EER", size(small) margin(medium)) /// box(1, color(gs4)) marker(1, mcolor(gs4) msize(small)) /// intensity(75) lintensity(100) graphregion(color(white)) /// scheme(s2color) legend(order( 1 "Butte" 2 "Torun")) /// yline(1) ylab("Ideal value") /// yline(0.79) ylab("Mean lower cut-off") /// yline(1.21) ylab("Mean upper cut-off")
2. Scatter plot: Is it possible to make more than 2 scatter plots in one twoway scatter plot? The variables are continuous (energy intake and energy expenditure), which I want to plot based on a categorical variable (with 3 categories: under, normal and over). The codes for the first scatter plot is:
Code:
twoway (scatter meanEI EER if report_BC1_1sd==0, /// xtitle(Energy requirement) ytitle(Energy Intake) title(Figure: Scatter of EI and EER, size(medsmall)) /// jitter(10) msize(small) color(gs10)) /// (scatter meanEI EER if report_BC1_1sd==1, jitter(10) msize(small) color(gs4)) , scheme(test3) /// legend(order( 0 "normal" 1 "under")) /// graphregion(color(white))
Code:
twoway (scatter meanEI EER if report_BC1_1sd==0, /// xtitle(Energy requirement) ytitle(Energy Intake) title(Figure: Scatter of EI and EER, size(medsmall)) /// jitter(10) msize(small) color(gs10)) /// (scatter meanEI EER if report_BC1_1sd==2, jitter(10) msize(small) color(gs4)) , scheme(test3) /// legend(order( 0 "normal" 2"over")) /// graphregion(color(white))
Is it also possible to have a lfit lines for the scatter plots?
Comment