 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: vertical lines between two co-ordinates in graph

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: vertical lines between two co-ordinates in graph Date Thu, 29 Sep 2011 11:10:13 +0100

```Here's one way to do it

gen my94 = 94
gen my0 = 0
gen x2 = 4
twoway (function y =  94              , range(0  4) )/*
*/    (function y =  x^2 + 14*x +  22, range(0 7.5) )  /*
*/    (function y = -x^2 - 10*x + 150, range(0 7.5) ) /*
*/    (rspike my94 my0 x2, legend(off))

and another

twoway (function y =  94              , range(0  4) )/*
*/    (function y =  x^2 + 14*x +  22, range(0 7.5) )  /*
*/    (function y = -x^2 - 10*x + 150, range(0 7.5) ) /*
*/    (scatteri 94 4 0 4, recast(line) legend(off))

Nick

On Thu, Sep 29, 2011 at 10:57 AM, Marco Ercolani
<m.g.ercolani@bham.ac.uk> wrote:

> Can Stata draw a vertical line between two co-ordinates of a graph? I need to do this for numerous graphs so I don't want to do it manually using a graph editor.
>
> I need a line that starts at the intersection of two curves and reaches down to the horizontal axis. For the example below, I can draw a horizontal line at y=94 for x= 0 to 4 but not the vertical line at x=4 for y= 0 to 94.
>
> twoway (function y =  94              , range(0  4) )/*
>  */    (function y =  x^2 + 14*x +  22, range(0 7.5) )  /*
>  */    (function y = -x^2 - 10*x + 150, range(0 7.5) ), /*
>  */    legend(off)

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```