I am creating a custom scheme in order to save time in creating my Stata plots. I would like to set the scheme to draw shaded confidence intervals with no outline around them. This is straightforward with commands such as lfitci, but I am having trouble when it comes to rarea and rspike plots, which I commonly use when creating marginal effects plots using margins... , plot.
The specific problem is that if set the scheme to erase the outlines on rarea graphs, by entering the following command in my scheme
linewidth pother none
then it also erases the lines on rspike and rcap graphs (and probably some others too). I would like to know if it is possible to write a scheme that erases those outlines for rarea plots but not for the others plots.
To illustrate what I have, and what I want, here is some simple code.
clear
set obs 100
gen x = rnormal()
gen z = rnormal()
gen y = x + z + x*z + rnormal(0,2)
reg y c.x##c.z
margins, at(x=(-2 -1 0 1 2) z=(-1 0 1)) plot(recastci(rarea) scheme(myscheme))
^ This is what I want, and it is produced by (linewidth pother none) in the scheme file. But that line also produces, with the default rcap plot,
margins, at(x=(-2 -1 0 1 2) z=(-1 0 1)) plot(scheme(myscheme))
^ i.e., the rcap lines and caps for the confidence intervals are missing. I can add them by manually adjusting the ci#opts... entries but that is now undermining the point of the exercise of making a scheme. If I remove (linewidth pother none) from the scheme file, the rcap lines and caps reappear as they should, but then the rarea plot looks like this:
... and I do not like those outlines. If anyone knows of a way to adjust the properties of rarea but not rcap and other plots in a Stata custom scheme, it'd be a great help.
The specific problem is that if set the scheme to erase the outlines on rarea graphs, by entering the following command in my scheme
linewidth pother none
then it also erases the lines on rspike and rcap graphs (and probably some others too). I would like to know if it is possible to write a scheme that erases those outlines for rarea plots but not for the others plots.
To illustrate what I have, and what I want, here is some simple code.
clear
set obs 100
gen x = rnormal()
gen z = rnormal()
gen y = x + z + x*z + rnormal(0,2)
reg y c.x##c.z
margins, at(x=(-2 -1 0 1 2) z=(-1 0 1)) plot(recastci(rarea) scheme(myscheme))
^ This is what I want, and it is produced by (linewidth pother none) in the scheme file. But that line also produces, with the default rcap plot,
margins, at(x=(-2 -1 0 1 2) z=(-1 0 1)) plot(scheme(myscheme))
^ i.e., the rcap lines and caps for the confidence intervals are missing. I can add them by manually adjusting the ci#opts... entries but that is now undermining the point of the exercise of making a scheme. If I remove (linewidth pother none) from the scheme file, the rcap lines and caps reappear as they should, but then the rarea plot looks like this:
... and I do not like those outlines. If anyone knows of a way to adjust the properties of rarea but not rcap and other plots in a Stata custom scheme, it'd be a great help.
Comment