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: Plot start to end dates using spike command


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Plot start to end dates using spike command
Date   Thu, 3 Oct 2013 12:52:12 +0100

Why not just

twoway rspike start end id, horizontal yla(1/5, ang(h)) ysc(reverse)
xtitle("Event lines")


Nick
[email protected]


On 3 October 2013 11:57, Hagger-Johnson, Gareth
<[email protected]> wrote:
> Dear Statalist
>
> I have some data in long format recording the start/end days of a period, the number of days in that period (days) and the day a separate event (eventday) occurred.
>
> id      start   end     days    eventday
> 1       1       2       1       30
> 1       40      40      0
> 2       25      26      1       200
> 2       265     268     3
> 3       10      15      5       17
> 4       20      25      5       234
> 5       15      35      20      16
>
> I have plotted these using the spike command.
>
> Is it possible to have horiztonal lines connecting the start and end days (line of length 'days')? Put differently, plot a line of length 'days' starting at 'start'?
> I can't seem to figure out how to start 'days' from 'start'.
>
> *******EXAMPLE
>
> gen length=365.25
>
> twoway spike length id, lcolor(none)horizontal || scatter id days,ms(none) mlabpos(0) mlabsize(*2) || scatter id start || scatter id end || scatter id eventday, title("Time period and separate event") legend(order(3 "Start" 4 "End" 5 "Event"))
>
> *****
>
> Thank you in advance; any suggestions appreciated.
>
> Gareth
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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