Compute Time Series Axis

DESCRIPTION:

Internal function to compute the parameters for the time axis for a calendar time series plot.

USAGE:

axis.time.build(pos, n.ticks=100, nobreaks=F, min.span=NULL,  
                mkt.oc=T, align.break=T, by.align=NULL,  
                k.by.align=NULL, extend=T,  
                skip.weekends=T, week.align="Monday", xlim=NULL) 

REQUIRED ARGUMENTS:

pos
the positions (x-values) of the time series.

OPTIONAL ARGUMENTS:

n.ticks
the approximate number of desired tick marks on the x-axis.
nobreaks
if TRUE, do not use axis breaks; if FALSE, then axis.compute.time.breaks is called to compute possible times for axis breaks.
min.span
(if nobreaks is FALSE) a time span object that is used to identify breaks as those time periods without positions that exceed min.span. If NULL, the default is selected from axis.break.table based on min(diff(pos))
mkt.oc
(if nobreaks is FALSE) TRUE or FALSE to determine whether daily market opening and closing times to use as axis breaks should be estimated from pos; can also be a list with named open and close components giving the regular opening and closing times of the market to use for generating axis breaks. The times are given as time span objects, representing the time after midnight for the daily openings and closings of the market.
align.break
(if nobreaks is FALSE) if TRUE, the break intervals are extended so that the intervals are aligned according to by.align and k.by.align.
by.align
(if nobreaks is FALSE) a character string giving the time units for aligning the intervals if align.break is TRUE. Possible values are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "minutes", "seconds", or "milliseconds". If NULL, the default is selected from axis.break.table based on min(diff(pos))
k.by.align
(if nobreaks is FALSE) an integer indicating the number of by.align units for aligning. If NULL, the default is selected from axis.break.table based on min(diff(pos))
extend
if TRUE, the axis is extended past the range of pos to the next small tick mark.
skip.weekends
if TRUE, the axis skips weekends if the time series has no data on the weekends.
week.align
a character string (or an integer, 0 to 6 with 0 being Sunday) to specify a weekday to align weekly tick marks to. The character string must be sufficient to make a unique case-insensitive match to the strings in options("time.day.name").
xlim
range limit for axis.

VALUE:

a list with components:
tick.by
a vector giving the "small.by" , "small.k.by", "medium.by" , "medium.k.by", "large.by" and "large.k.by" ticks.
intervals
a list with open and close components, giving the market open and close times to use in axis breaks.
nobreaks
if TRUE, the axis has no breaks; if FALSE, it does.
n.ticks
the requested (not actual) number of tick marks.
extend
whether the axis is to be extended to the nearest small tick mark.
pos
the input positions pos.
skip.weekends
the input value of skip.weekends.
week.align
the input value of week.align.

DETAILS:

The function first calls axis.compute.time.breaks to compute any breaks in the x-axis and computes the total time range (taking into account the breaks). Based on the total time range and the requested number of ticks n.ticks, it then looks up the tick.by returned value in axis.tick.table.

SEE ALSO:

,