I want to combine two marginsplots in a single graph. One of them (Graph 1) is a conditional effects plot with two lines illustrating an interaction effect. The other (Graph 2) is a simpler main effect, predictive margins plot with a single line. While Graph 1 is rendered with a legend for the two lines, Graph 2 (correctly) does not have a legend -- which is why its y axis (which is on the same scale as that of Graph 1) extends further down, filling the empty space filled by the legend in Graph 1. This is what I am trying to prevent.
I have tried using the legend options for Graph 2 to add an "empty" legend to prevent the y axis from extend further down, but they have been ignored by Stata. Using the -label- suboption as proposed here does not work:
Neither does the -order- suboption of -legend- as proposed here:
I am sure I am missing something really basic here, but since no amount of searching and manual inspection is helping, I'd appreciate if someone can spot what is going here, and how I could align the y axis of the graph without legend to the y axis of the graph with a legend. Any help is much appreciated!
I have tried using the legend options for Graph 2 to add an "empty" legend to prevent the y axis from extend further down, but they have been ignored by Stata. Using the -label- suboption as proposed here does not work:
Code:
marginsplot, recast(line) title("Graph 2") /// plot( , label("does not appear")) /// xtitle("appears", height(5)) /// yscale(r(0 1)) ylabel(0(.2)1, grid) ytitle("appears")
Code:
marginsplot, recast(line) title("Graph 2") /// plotopts(lwidth(medium) legend(order(3 "does not" 4 "appear"))) /// xtitle("appears", height(5)) /// yscale(r(0 1)) ylabel(0(.2)1, grid) ytitle("appears")
Comment