Statalist


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

st: Adding vertical lines at variable positions


From   Ron Gutmark <rgutmar1@jhmi.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Adding vertical lines at variable positions
Date   Fri, 3 Jul 2009 15:34:24 -0400

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

-- 
Ron Gutmark
Johns Hopkins University School of Medicine
*
*   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/



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