[R-SIG-Finance] plot.zoo axis labels/ticks

Jeff Ryan jeff.a.ryan at gmail.com
Fri Feb 1 20:20:24 CET 2008


Markus,

I can't necessarily help with the zoo example, but...

The quantmod package has a charting facility that does what I think you want.

Generally speaking you can pass any zoo object into chartSeries() and
it will draw an OHLC style chart (if it has OHLC qualities/columns),
or a line-chart if it is a univariate object.

The labeling is handled inside the main chartSeries call by a local
function called ticks().  Basically uses some formatting functions
inside of quantmod and xts to find a suitable looking set of tickmarks
- both major (with labels) and minor (lighter color and _no_ labels).
The labels even get formatted based on the underlying periodicity of
the data, as well as the level of detail (intraday will work, as will
yearly...).

chartSeries itself may do all you need.  If not feel free to take the
ticks code and the associated xts/quantmod functions and copy to your
own solution.

If you need more assistance, I can probably elaborate here, or email
me directly.

Jeff
On Feb 1, 2008 7:03 PM, Markus Loecher <markus at insightfromdata.com> wrote:
> Dear zoo experts,
> While I follow the custom x-axis example in the help file for plot.zoo(), it
> is not clear to me how to easily display ticks at "natural" intervals, such
> as months/weeks/days.
> For example, when I plot a daily series that extends over ~ 2 years, the
> default seems to place labels only at the yearly marks, whereas I would
> often want monthly or quarterly ticks/labels.
>
> Any help would be great,
> Thanks,
> Markus
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



-- 
There's a way to do it better - find it.
Thomas A. Edison



More information about the R-SIG-Finance mailing list