[R-SIG-Finance] plots with hystorical data

Brian G. Peterson brian at braverock.com
Fri May 24 14:22:31 CEST 2013


On 05/24/2013 07:18 AM, Alexandra Allexa wrote:
> I feel ashamed to ask this, but I tried a lot and I do not know where
> I have to search an answer for my problem.
>
> I have to plot some hystorical data, nothing special ar difficult,
> but I don't know haw to do to appear on the x axis the dates of my
> data.
>
> For example my database has records starting with 03th January 2001
> but on x axis apear as label dates starting with 2nd January 1970.
> What is the function for corrige my plots? I have been trying
> funtions from the packages xts and zoo.

You didn't provide a reproducible example, so anyone who answers is just 
guessing, but it seems likely that your
source data is not a time series.

You probably have a data.frame or matrix or similar, and when you use 
plot, you're getting a forced index.

check the class of your input data to make sure that it is xts.

then plot (from zoo, xts, or xtsExtra) or chart_Series or chartSeries 
(from quantmod) will work just fine.

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list