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: Changing the scale of a graph
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
RE: st: Changing the scale of a graph
Date
Fri, 8 Jun 2012 17:43:32 +0100
The problem may look similar, but I think the explanation is different.
Stata is showing dates 30nov2007 13apr2009 26aug2010 8jan2012 on the x axis. So why is it doing that?
. di d(30nov2007)
17500
. di d(13apr2009)
18000
. di d(26aug2010)
18500
. di d(8jan2012)
19000
shows that these are dates 17500(500)19000 and so understandable default choices. Better choices for you might be 1jan2009 ... 1jan2011. So you can go (e.g.)
xla(`=mdy(1,1,2009)' `=mdy(1,1,2010)' `=mdy(1,1,2011)', format(%td))
See also
SJ-7-4 gr0030 . Stata tip 55: Better axis labeling for time points/intervals
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
Q4/07 SJ 7(4):590--592 (no commands)
tip on labeling graphs for time points and time intervals
http://www.stata-journal.com/sjpdf.html?articlenum=gr0030
Nick
[email protected]
stef salvez
Maybe the problem you described bove is similar to mine. I get a lot
of white space on the left of the plot
Have a look:
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)|| scatter Bel dBelgium || //
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/