Re: [R] How can I shade the background area of a zoo time series object between specific dates?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu, 19 Jun 2008 11:42:26 -0400

See ?rect

library(zoo)
d1 <- as.Date("2007-04-12")
d2 <- as.Date("2008-05-14")
plot(SP500, type = "n")
rect(d1, par("usr")[3], d2, par("usr")[4], col = "red", border = 0) lines(SP500)

Also, there is an example using the lattice/grid-based xyplot.zoo in ?xyplot.zoo

On Thu, Jun 19, 2008 at 10:48 AM, Vorlow Constantinos <CVorlow_at_eurobank.gr> wrote:
> Dear list members,
>
> How can I shade the background area of a zoo time series object between
> specific dates?
>
> eg.
>
> library(tseries)
> library(zoo)
> SP500<-get.hist.quote("^GSPC", start = "1990-01-01", quote =
> "Close")
> plot(SP500)
>
> How can I produce the same plot but with a (say) red background between
>
> 2007-04-12
>
> and
>
> 2008-05-14
>
> ?
>
> Many thanks in advance...
>
> Costas
>
>
> P Think before you print.
>
> Disclaimer:
> This e-mail is confidential. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete the copy from your system.
> EFG Eurobank Ergasias S.A. is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
> EFG Eurobank Ergasias S.A. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 19 Jun 2008 - 16:11:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 Jun 2008 - 16:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive