[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Adding vertical lines at variable positions

From   Austin Nichols <>
Subject   Re: st: Adding vertical lines at variable positions
Date   Fri, 3 Jul 2009 15:58:16 -0400

Ron Gutmark<> :
It's clear from
help added_line_options
that xline() does not take a variable as an argument.  See
help twoway_spike
for a way to superimpose a spike (or line if the y value is at the max
of the y range).

On Fri, Jul 3, 2009 at 3:34 PM, Ron Gutmark<> wrote:
> Hi,
> I have a data set with ages and eye pressures.  I have the data points
> that refer to pressure at a particular age labeled with different
> colors (thanks to help from people on this list!!) depending on what
> happened at a particular age (i.e. surgery, laser treatment, etc).
> I have certain ages during which these interventions happened but I
> don't have pressures for these ages, so I was trying to make colored
> vertical lines at the ages missing pressures to represent what
> happened at that age.  I am trying to use xline, but it does not seem
> to be allowing me to use a variable to define where to place the line
> and it gives me an error even when I use an arbitrary number.  Does
> anyone know how to do this or what I am doing wrong? Below is the code
> I am trying to use:
> twoway (scatter pressure age if colorcode == "R", mcolor(red))
> (scatter pressure age if colorcode == "Y", mcolor(yellow)) (scatter
> pressure age if colorcode == "B", mcolor(blue)) (scatter pressure age
> if colorcode == "K", mcolor(black)) if name == "Almj", (xline(age,
> lcolor(yellow)) if colorcode == "Y"), (xline(age, lcolor(red)) if
> colorcode == "R"), (xline(age, lcolor(blue)) if colorcode == "B")
> Thanks in advance!
> Ron

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index