Stata/BE 17.0 for Mac (Intel 64-bit) Revision 13 Oct 2022
I am trying to combine a marginplot and a frequency histogram. I seem to be getting close to what I want, but I seem to be struggling to use addplot's below option properly. This is my current code:
This is the graph:

It's getting very close, but I really would prefer it if the marginplot was at the top. That would seem to be the purpose of the below option.
I know that there is a module called MARHIS, but that doesn't give me as much control over the histogram.
Please let me know if more information is needed than I have provided.
I am trying to combine a marginplot and a frequency histogram. I seem to be getting close to what I want, but I seem to be struggling to use addplot's below option properly. This is my current code:
Code:
logit txflr_yn path1_crp local crp_n = e(N) local crp_psR2: dis %6.3f e(r2_p) local crp_pr: di %12.7f e(p) // Run marginal effects estimation margins, at(path1_crp=(0(10)400)) // Marginsplot marginsplot, xdimension(path1_crp) plotopts(msymbol(none)) /// ytitle("Pr(Treatment Non-Response)") /// xtitle("C-Reactive Protein (mg/L)") /// title("") /// note("N = `crp_n'" "Pseudo R{superscript:2} = `crp_psR2'" "p = `crp_pr'") /// name("logit_crp", replace) /// recastci(rarea) ciopts(color(%50) lpat(line)) /// addplot((histogram path1_crp if path1_crp <450, frequency width(10) fcolor(blue%30) lcolor(blue%30) xscale(range(0 450)) yaxis(2) yscale(alt axis(2))), below)
It's getting very close, but I really would prefer it if the marginplot was at the top. That would seem to be the purpose of the below option.
I know that there is a module called MARHIS, but that doesn't give me as much control over the histogram.
Please let me know if more information is needed than I have provided.