I am generating a customized plot displaying the 95% confidence interval of my estimate of interest for different heterogeneity results. Each heterogeneity result classifies the data in different ways.
In the simple example below, the variable "het" refers to the class of heterogeneity and the variable "indicator" refers to specific classifications used within the given class of heterogeneity.
In the end of the code below, I generate the plot I am interested in. I would like to add some text below the x-axis in order to group different results that belong to the same class of heterogeneity.
I would like to add below the x-axis the respective class of heterogeneity under consideration. In other words, I would like to add the text "Heterogeneity 1" below the first two groups in the x-label, the text "Heterogeneity 2" below the following two groups, and the text "Heterogeneity 3" below the last four groups in the x-label.
In the simple example below, the variable "het" refers to the class of heterogeneity and the variable "indicator" refers to specific classifications used within the given class of heterogeneity.
In the end of the code below, I generate the plot I am interested in. I would like to add some text below the x-axis in order to group different results that belong to the same class of heterogeneity.
Code:
clear input str20 het het_n effect ci_lower ci_upper het1 1 -.1929327 -.2123405 -.1735249 het1 2 -.1395898 -.20109 -.0780896 het2 1 -.2646643 -.297335 -.2319936 het2 2 -.1605406 -.179301 -.1417801 het3 1 -.1977444 -.2177585 -.1777303 het3 2 -.1425936 -.1642216 -.1209657 het3 3 -.1235394 -.1589206 -.0881581 het3 4 -.0993597 -.1991288 .0004095 end list, sep(0) // GENERATING PLOT gen x = 1 if het=="het1" & het_n==1 replace x = 2 if het=="het1" & het_n==2 replace x = 4 if het=="het2" & het_n==1 replace x = 5 if het=="het2" & het_n==2 replace x = 7 if het=="het3" & het_n==1 replace x = 8 if het=="het3" & het_n==2 replace x = 9 if het=="het3" & het_n==3 replace x = 10 if het=="het3" & het_n==4 twoway (rcap ci_upper ci_lower x if het=="het1", lcol(navy)) (scatter effect x if het=="het1", mcol(navy)) /// (rcap ci_upper ci_lower x if het=="het2", lcol(cranberry)) (scatter effect x if het=="het2", mcol(cranberry)) /// (rcap ci_upper ci_lower x if het=="het3", lcol(brown)) (scatter effect x if het=="het3", mcol(brown)), xscale(range(0 11)) xlabel(1 "type 1" 2 "type 2" 4 "type 1" 5 "type 2" 7 "type 1" 8 "type 2" 9 "type 3" 10 "type 4", noticks labsize(small) angle(vertical)) legend(off) xtitle("") ytitle("Policy effect") yscale(titlegap(2)) ylabel(, labsize(small)) yline(0, lcolor(black) lpattern(dash)) graphregion(color(white))
I would like to add below the x-axis the respective class of heterogeneity under consideration. In other words, I would like to add the text "Heterogeneity 1" below the first two groups in the x-label, the text "Heterogeneity 2" below the following two groups, and the text "Heterogeneity 3" below the last four groups in the x-label.
Comment