Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: additional lines in a plot


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: additional lines in a plot
Date   Fri, 8 Jun 2012 19:47:59 +0100

-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 <loggyedy@googlemail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index