[R-SIG-Finance] Chart formats
Gabor Grothendieck
ggrothendieck at gmail.com
Fri May 1 17:47:51 CEST 2009
In this case the following gives years:
plot(as.zoo(GS[,1]))
and if variations of it do not, you can force it:
plot(as.zoo(GS[,1]), xaxt = "n")
years <- as.Date(unique(cut(time(GS), "year")))
axis(1, at = years, lab = format(years, "%Y"))
On Fri, May 1, 2009 at 11:10 AM, Heiko Mayer <Heiko-Mayer at gmx.de> wrote:
> Hi all,
>
> I am trying to get a chart with "years" shown only on the x-axis (e.g. 2005,2006,2007). However, xts and ts always show the day, month and year as shown below. I can hardly believe, the only solution is manually creating a character vector. Does anyone know a smarter idea? Or is there a library I might have overseen providing this functionality?
>
> library(xts)
> library(quantmod)
> getSymbols("GS")
> plot(GS[,1],major.ticks='years')
>
> Thanks,
> Heiko
> --
>
> _______________________________________________
> 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.
>
More information about the R-SIG-Finance
mailing list