Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Need separate lines in twoway rcapsym


From   Nick Cox <njc@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Need separate lines in twoway rcapsym
Date   Mon, 30 Aug 2004 16:11:59 -0500

Joseph Wagner

I am trying to create a graph of survival time by individual but I keep
getting overlapping lines:

twoway (scatter year hivdate)(rcapsym origin enddate year, jitter)  ///
(scatter year rxdate)

I wanted to have a series of horizontal lines representing their survival
time (from origin to enddate) with a marker for hivdate and rxdate arrayed
along the y-axis in order by birth (year only).  But I have several subjects
with the same year of birth so I end up with overlapping lines.

I have tried jitter which gives me separate symbols but not separate lines.
Is there a way to separate the lines?  As an alternative, I have used -egen
rank, unique- to create a variable that ranks all subjects uniquely in order
by birth year but I can't figure out how to get my y-axis label to reflect
the appropriate range of years since the range of the rank variable (0-157)
is greater than the age range (1906-1978).

Is there a way to get the y-axis labeled as I wish or is there a better way
to create my graph altogether?
I would first label individuals 1 up, breaking any ties by some presumed
id variable, say

egen person = group(origin enddate id)

Then something like

twoway rcapsym origin enddate person, horiz ||
scatter person hivdate ||
scatter person rxdate

A discussion of neighbo[u]ring territory is, or will be, in

Graphing agreement and disagreement. Stata Journal 4(3): 329--349 (2004).

Nick

njc@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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