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: using round time numbers on the x-axis of a stata graph
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: using round time numbers on the x-axis of a stata graph
Date
Sun, 22 Jan 2012 10:46:53 +0000
Here is some technique
. local start = clock("21 Jan 2012 00:00:00", "DMYhms")
. di "`start'"
1642723200000
. local finish = clock("22 Jan 2012 00:00:00", "DMYhms")
. local step = 1000 * 60 * 60
. ..., xtic(`start'(`step')`finish')
Let's also guess that you want some labels, but fewer, e.g.
local step2 = `step' * 3
. ..., xla(`start'(`step2')`finish', format(%tchh:mm))
Nick
On Sat, Jan 21, 2012 at 8:56 PM, Molly McMahon <[email protected]> wrote:
> I have stata 12, and I have created a scatterplot with a time of day
> variable as the x-axis. The time variable is formatted as %tc,
> contains information for a single date, and times range from 00:00:00
> to 16:58:55.
> I would like the x-axis ticks to reflect even hours, i.e. 00:00:00,
> 01:00:00, 02:00:00, etc. and I cannot get this to work. Any assistance
> is much appreciated.
*
* 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/