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   "Wagner, Joseph" <>
To   "STATAList (" <>
Subject   Re: st: Need separate lines in twoway rcapsym
Date   Wed, 1 Sep 2004 14:36:14 -0400

Thanks Nick, that gave me the unique identifier I needed but do you know of
a way to get the y-axis labeled with the years rather than 1-157 for the
variable person?  

(By the way, lately I have started having trouble whenever I click on the
graphics tab on the pull down menu.  It used to take some period of time to
bring the menu up but now Stata just freezes.)

>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
>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).


*   For searches and help try:

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