[R-SIG-Finance] two zoo questions
Achim.Zeileis at wu-wien.ac.at
Fri May 9 12:38:48 CEST 2008
On Fri, 9 May 2008, michal miklovic wrote:
> I have a zoo object with three time series and the corresponding dates.
> When I plot it, the x-axis contains dates which are not in the object
> and, naturally, no data points are displayed for these dates. For
> example, the date "2006-05-20" is not in the object, but it appears in
> the x-axis of the plot. As a result, I get a plot with 'empty' segments.
I cannot reproduce that problem. For me 2006-05-22 is the first label
displayed. In any case, 2006-05-20 is within the range of
time(ShorterSpan) so I wouldn't be too surprised if it would appear. If
you want fine control over the axis, you can
plot(ShorterSpan, ..., axes = FALSE)
axis.Date(1, time(ShorterSpan), ...)
and pass all desired arguments to axis.Date() including "at" and "format".
> My second question concerns the way of displaying the dates on the
> x-axis. Currently, the dates are displayed as "V 22", which stands for
> "2006-05-22". I would like them to be displayed as "22 05 2006" or "22
> May 2006". How can I do this?
Either suppress axes and add them by hand afterwards as outlined above, or
simply set format = "%d %b %Y" in your plot() call.
Both will lead to a couple of warnings but produce the desired result.
More information about the R-SIG-Finance