I'm using Stata/IC 14.2.
I want to shade the area between two vertical lines, but have two problems:
This produces the following figure:
If I could replace the values of -50 and 90 with the edges of the plot area I believe that would solve #1. I'm not quite sure about #2.
I want to shade the area between two vertical lines, but have two problems:
- The shading does not cover the entire vertical range of the plot. I believe I could fix this if there were a way to identify the maximum and minimum y values that Stata includes in graph region, but I have been unable to figure out how to do this. Is there a way to know before plotting what these values are? I am making several figures in a loop so eyeballing it won't help.
- The vertical lines are covered by the shading. Is there a way to fix this?
Code:
clear sysuse sp500 gen t = _n twoway (scatteri -50 70 -50 80, bcolor(gs12) recast(area) plotr(m(zero))) /// (scatteri 90 70 90 80, bcolor(gs12) recast(area) plotr(m(zero))) /// (scatter change t), /// xline(70 80, lcolor(black) lpattern(dash)) /// legend(off)
If I could replace the values of -50 and 90 with the edges of the plot area I believe that would solve #1. I'm not quite sure about #2.