Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: Horizontal time line graph of individual with time events


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Horizontal time line graph of individual with time events
Date   Fri, 4 Mar 2011 19:06:48 +0000

Here's a better solution than my previous: 

label val id idlbl

gen admdays1 = admdays + 0.1
gen admdays2 = admdays - 0.1 

twoway spike length id, horizontal || ///
rbar admdays? id, horizontal barw(0.5)  || ///
scatter id pcr1,ms(s)mfc(yellow)msize(*3) || ///
scatter id pcr2, ms(s)mfc(yellow)msize(*3) || ///
scatter id pcr1neg, ms(Sh) msize(*2.1) || ///
scatter id tamistartd, ms(0) || ///
scatter id tamistopd, title("Days since onset of fever") ///
ysc(reverse)ms(O) yla(1/9,val ang(h) noticks)  ///
legend(order(2 "Start of fever" 3 "First PCR+" 4 "Last PCR+" 5 "First PCR-" 6 "Tamiflu start" 7 "Tamiflu stop" )pos(3) col(1))

So, no pipes: just a short horizontal bar. You still need to edit the size of the bar symbol in the legend. 

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 04 March 2011 18:51
To: '[email protected]'
Subject: RE: st: Horizontal time line graph of individual with time events

Only two ideas so far:

1. Edit the legend in the Editor. I wasn't able to do it without leaving unfilled space where the legend should have been. 

2. Create your own legend from scratch using graph commands. 

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 04 March 2011 17:59
To: [email protected]
Subject: Re: st: Horizontal time line graph of individual with time events

If I can think of a way of getting the | symbol in the legend, I will post it.

Your other questions are for StataCorp. The new symbol I'd most like
to see personally is a downward-pointing triangle.

Nick

On Fri, Mar 4, 2011 at 4:20 PM, Jannik Helweg-Larsen <[email protected]> wrote:
> Thank you very much!- just the start I needed- very useful link
>
> Two small follow up questions:
>
> 1. Regarding the  non-standard marker "pipe" = "|", which I use to
> indicate start of admission:  Is it possible somehow to illustrate
> this marker in the legend at right (see example below- next to "Start
> of fever") ?
>
> I wonder why this marker sign-"|"- is not included as a default marker option?
>
> 2. I had to experiment to get similar sizes of the shallow (msize) and
> solid squares- why are Sh(shallow) and S(solid) not the same size?
>
> To illustrate and for anyone interested, here is a preliminary code
> for a slightly different graph, now including first day with negative
> influenza pcr)
>
> id  length  admdays  pcr1  pcr2  pcr1neg  tamistartd  tamistopd
>  1      42        2    12    25       27          12         31
>  2      23        3    13    16       21          15         21
>  3      26        5     5    16       19           6         11
>  4      22       10    10    14        .          11         15
>  5       5        0     2     5        .           3          5
>  6      29        1     4    11        .           7         12
>  7      29        1     1    11        .           1         15
>  8      29        7     9    14       17          10         18
>  9      32        4     5    13        .           4         17
>
> label define idlbl             ///
>  1 "Immunosuppressed"      ///
>  2 "Alcoholic"  ///
>  3 "COPD"      ///
>  4 "Pregnant"   ///
>  5 "Myelomatosis" ///
>  6 "Lymphoma"   ///
>  7 "Leukemia"  ///
>  8 "HIV" ///
>  9 "Pregnant" ///
>
>  label val id idlbl
>
> generate pipe = "|"
>
> twoway spike length id, horizontal || ///
> scatter id admdays,ms(none) mlabpos(0) mlabel(pipe) mlabsize(*2) || ///
> scatter id pcr1,ms(s)mfc(yellow)msize(*3) || ///
> scatter id pcr2, ms(s)mfc(yellow)msize(*3) || ///
> scatter id pcr1neg, ms(Sh) msize(*2.1) || ///
> scatter id tamistartd, ms(0) || ///
> scatter id tamistopd, title("Days since onset of fever")
> ysc(reverse)ms(O) yla(1/9,val ang(h) noticks)  ///
> legend(order(2 "Start of fever" 3 "First PCR+" 4 "Last PCR+" 5 "First
> PCR-" 6 "Tamiflu start" 7 "Tamiflu stop" )pos(3) col(1))

*

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index