Hi! I'm currently trying to generate a graph using marginsplot for my dissertation, to display how a treatment (exposure to the news of a US Supreme Court ruling) affects my outcome variable (European perceptions of the US). I have a treatment variable coded as 0=control group (interviewed before the court ruling) and 1=treatment group (interviewed after the court ruling). I'm trying to generate three graphs displaying the 95% CI for 1. the overall effect, 2. differences according to gender, and 3. differences according to political affiliation. I want it to look like this:

I've managed to create the middle graph (gender differences) and third graph (political affiliation) using this command:
logit USperception i.treatment##i.sex, rob
margins treatment, at(sex=(0 1))
marginsplot, recast(scatter)
logit USperception i.treatment##i.leftright, rob
margins treatment, at(leftright=(1 2 3))
marginsplot, recast(scatter)
However, the graph for the overall effect comes out like this (see below), splitting up the control and treatment group on two different lines on the x-axis instead of a red and blue CI on the same "line". I want them to be on the same "line" (as the picture above) so the results are easier to interpret next to the other two graphs.

For this graph, I used the command:
logit USperception i.treatment, robust
margins treatment
marginsplot, recast(scatter)
If someone knows the right command for making the graph look like the one I have sketched, please let me know! Any help would be appreciated
I've managed to create the middle graph (gender differences) and third graph (political affiliation) using this command:
logit USperception i.treatment##i.sex, rob
margins treatment, at(sex=(0 1))
marginsplot, recast(scatter)
logit USperception i.treatment##i.leftright, rob
margins treatment, at(leftright=(1 2 3))
marginsplot, recast(scatter)
However, the graph for the overall effect comes out like this (see below), splitting up the control and treatment group on two different lines on the x-axis instead of a red and blue CI on the same "line". I want them to be on the same "line" (as the picture above) so the results are easier to interpret next to the other two graphs.
For this graph, I used the command:
logit USperception i.treatment, robust
margins treatment
marginsplot, recast(scatter)
If someone knows the right command for making the graph look like the one I have sketched, please let me know! Any help would be appreciated

Comment