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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: AW: Adding vertical lines at variable positions |

Date |
Fri, 3 Jul 2009 22:40:29 +0200 |

<> As has been said, a variable is not allowed as an argument to -xline-. And yet, it does tolerate repeated use, as is apparent from - help added_line_options, marker(remarks2)-. This tolerance does not extend to the repeated use of commata. The comma really serves to separate options from the main command, so use it only once! I hope that the example below gets you closer to your final destination :-) ************* sysuse auto, clear levelsof rep, loc(re) loc gr "" foreach lev of numlist `re'{ loc gr `gr' (sc pr length if rep==`lev') su len if rep==`lev', mean loc mean`lev' `r(mean)' } tw `gr', xli(`mean1', lcolor(green))/* */ xli(`mean2', lcolor(blue)) /* */ xli(`mean3', lcolor(gold)) /* */ xli(`mean4', lcolor(red)) /* */ xli(`mean5', lcolor(black))/* */ legend(off) ************* HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ron Gutmark Gesendet: Freitag, 3. Juli 2009 21:34 An: statalist@hsphsun2.harvard.edu Betreff: st: Adding vertical lines at variable positions 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/ * * 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/

**References**:**st: Adding vertical lines at variable positions***From:*Ron Gutmark <rgutmar1@jhmi.edu>

- Prev by Date:
**st: Re: Random Effects and RE Tobit** - Next by Date:
**Re: st: AW: Displaying multiple indicators for esttab** - Previous by thread:
**Re: st: Adding vertical lines at variable positions** - Next by thread:
**st: cubic spline** - Index(es):

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