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: additional lines in a plot


From   stef salvez <[email protected]>
To   [email protected]
Subject   Re: st: additional lines in a plot
Date   Fri, 8 Jun 2012 22:29:39 +0100

But I do not know how to add these vertical lines every 28 dates. Some
help would be greatly appreciated. It is an advanced topic and you are
the right person to provide some information

On 6/8/12, stef salvez <[email protected]> wrote:
> Thanks Nick.
>
> As you said I added xline() for one time point for Austria:
>
>
>   scatter Aus  dAustria, xsize(20) ysize(8) c(l l)  xline( 17922 ) ||///
>  scatter Bel dBelgium , c(l l)    || ///
>  scatter Aus t10, ms(none) mla(dA2) mlabpos(910) || ///
>  scatter Bel t9 , ms(none) mla(dB2) mlabpos(910) ///
>  yla(9 "Belgium"  10 "Austria"    , ang(h)) ///
>  xla(`=mdy(10,5,2008)' `=mdy(1,1,2010)' `=mdy(1,1,2012)', format(%td))
> legend(off)
>
> and it worked. The only difficulty is that I have to insert manually
> all these numbers (like 17922) which are the numerical representation
> of the dates. IS there any quicker way to do that; as I have many
> countries and for each country I have a different a sequence of dates.
> One example would be sufficient for me to understand how to move on,
>
>
> thanks again
>
>
> On 6/8/12, Nick Cox <[email protected]> wrote:
>> -xaxis()- is an option, not a command, but of no help here. You want
>> -xline()-. See also the SJ Tip cited earlier today to you.
>>
>> Nick
>>
>> On Fri, Jun 8, 2012 at 6:30 PM, stef salvez <[email protected]>
>> wrote:
>>
>>>  According to the dataset below i have observations every 28 days (4
>>> weeks)  but in some cases i have jumps ( 35 days-or 5 weeks- and 42
>>> days -or 6 weeks).
>>>
>>>  I would like to construct vertical gridlines   every 28 days so as
>>> to see easier the one- and/or two-week shifts. The solution mignt be
>>> the
>>>  -xaxis- command but i do not know exactly how to fit it to the code
>>> below
>>>
>>>
>>> clear all
>>> cd d:\
>>> input str8  (Austria           Belgium          )
>>>  "2/11/08"     "07/12/08"
>>> "30/11/08"          "04/01/09"
>>> "28/12/08"          "01/02/09"
>>> "25/01/09"          "01/03/09"
>>> "22/02/09"          "29/03/09"
>>> "22/03/09"          "26/04/09"
>>> "19/04/09"          "24/05/09"
>>> "17/05/09"          "21/06/09"
>>> "14/06/09"          "19/07/09"
>>> "12/07/09"          "16/08/09"
>>> "09/08/09"          "13/09/09"
>>> "06/09/09"          "11/10/09"
>>> "04/10/09"          "08/11/09"
>>> "01/11/09"          "06/12/09"
>>> "29/11/09"          "03/01/10"
>>> "27/12/09"          "31/01/10"
>>> "31/01/10"          "28/02/10"
>>> "28/02/10"          "28/03/10"
>>> "28/03/10"          "25/04/10"
>>> "25/04/10"          "23/05/10"
>>> "23/05/10"          "20/06/10"
>>> "20/06/10"          "18/07/10"
>>> "18/07/10"          "15/08/10"
>>> "15/08/10"          "12/09/10"
>>> "12/09/10"          "10/10/10"
>>> "10/10/10"          "07/11/10"
>>> "07/11/10"          "05/12/10"
>>> "05/12/10"          "02/01/11"
>>> "01/01/11"          "30/01/11"
>>> "30/01/11"          "27/02/11"
>>> "27/02/11"          "27/03/11"
>>> "27/03/11"          "24/04/11"
>>> "24/04/11"          "22/05/11"
>>> "22/05/11"          "19/06/11"
>>> "19/06/11"          "17/07/11"
>>> "17/07/11"          "14/08/11"
>>> "14/08/11"          "11/09/11"
>>> "11/09/11"          "09/10/11"
>>> "09/10/11"          "06/11/11"
>>>
>>> end
>>> gen dAustria = date(Austria, "DM20Y")
>>> gen dBelgium = date(Belgium, "DM20Y")
>>>
>>> gen dA2 = dAustria - dAustria[_n-1]
>>> gen dB2 = dBelgium - dBelgium[_n-1]
>>>  gen Aus= 10
>>> gen Bel = 9
>>> gen t10 = (dAustria + dAustria[_n-1]) / 2
>>> gen t9 = (dBelgium + dBelgium[_n-1]) / 2
>>>
>>>  scatter Aus  dAustria, xsize(20) ysize(8) c(l l)|| scatter Bel
>>> dBelgium , c(l l)    || //
>>> scatter Aus t10, ms(none) mla(dA2) mlabpos(910) || ///
>>> scatter Bel t9 , ms(none) mla(dB2) mlabpos(910)
>>>  yla(9 "Belgium"  10 "Austria"    , ang(h)) xla(, format(%td))
>>> legend(off)
>>>
>>
>> *
>> *   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