abline with zoo series

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

abline with zoo series

Erin Hodgess-2
Hello!  Happy Thanksgiving to those who are celebrating.

I have a zoo series that I am plotting, and I would like to have some
vertical lines at certain points, to indicate US business cycles.  Here is
an example:

app1 <- get.hist.quote(instrument="appl",
start="1985-01-01",end="2016-08-31", quote="AdjClose", compression="m")
#Fine
plot(app1,main="Historical Stock Prices: Apple Corporation")
#Still Fine
#Now I want to use abline at July 1990 and March 1991 (as a start) for
business cycles.  I tried v=67 and v="1990-07", no good.

I have a feeling that it's really simple and I'm just not seeing it.

Any help much appreciated.

Thanks,
Erin


--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: abline with zoo series

Jim Lemon-4
Hi Erin,
I would look at:

par("usr")

to see what the range of the abscissa might be.

Jim


On Fri, Nov 25, 2016 at 2:03 PM, Erin Hodgess <[hidden email]> wrote:

> Hello!  Happy Thanksgiving to those who are celebrating.
>
> I have a zoo series that I am plotting, and I would like to have some
> vertical lines at certain points, to indicate US business cycles.  Here is
> an example:
>
> app1 <- get.hist.quote(instrument="appl",
> start="1985-01-01",end="2016-08-31", quote="AdjClose", compression="m")
> #Fine
> plot(app1,main="Historical Stock Prices: Apple Corporation")
> #Still Fine
> #Now I want to use abline at July 1990 and March 1991 (as a start) for
> business cycles.  I tried v=67 and v="1990-07", no good.
>
> I have a feeling that it's really simple and I'm just not seeing it.
>
> Any help much appreciated.
>
> Thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: [hidden email]
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: abline with zoo series

David Winsemius
In reply to this post by Erin Hodgess-2

> On Nov 24, 2016, at 7:03 PM, Erin Hodgess <[hidden email]> wrote:
>
> Hello!  Happy Thanksgiving to those who are celebrating.
>
> I have a zoo series that I am plotting, and I would like to have some
> vertical lines at certain points, to indicate US business cycles.  Here is
> an example:
>

library(tseries)
> app1 <- get.hist.quote(instrument="aapl",  # note correction
> start="1985-01-01",end="2016-08-31", quote="AdjClose", compression="m")
> #Fine
> plot(app1,main="Historical Stock Prices: Apple Corporation")
> #Still Fine
> #Now I want to use abline at July 1990 and March 1991 (as a start) for
> business cycles.  I tried v=67 and v="1990-07", no good.

#Try this:

abline( v= as.Date("1990-07-01") )

The x-axis is being created using the Date class values and formatting.


>
> I have a feeling that it's really simple and I'm just not seeing it.
>
> Any help much appreciated.
>
> Thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: [hidden email]
>
> [[alternative HTML version deleted]]

Sigh.

>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: abline with zoo series

Erin Hodgess-2
Awesome!!!!
Thanks!!!!!

Sincerely,
Erin


On Thu, Nov 24, 2016 at 10:14 PM, David Winsemius <[hidden email]>
wrote:

>
> > On Nov 24, 2016, at 7:03 PM, Erin Hodgess <[hidden email]>
> wrote:
> >
> > Hello!  Happy Thanksgiving to those who are celebrating.
> >
> > I have a zoo series that I am plotting, and I would like to have some
> > vertical lines at certain points, to indicate US business cycles.  Here
> is
> > an example:
> >
>
> library(tseries)
> > app1 <- get.hist.quote(instrument="aapl",  # note correction
> > start="1985-01-01",end="2016-08-31", quote="AdjClose", compression="m")
> > #Fine
> > plot(app1,main="Historical Stock Prices: Apple Corporation")
> > #Still Fine
> > #Now I want to use abline at July 1990 and March 1991 (as a start) for
> > business cycles.  I tried v=67 and v="1990-07", no good.
>
> #Try this:
>
> abline( v= as.Date("1990-07-01") )
>
> The x-axis is being created using the Date class values and formatting.
>
>
> >
> > I have a feeling that it's really simple and I'm just not seeing it.
> >
> > Any help much appreciated.
> >
> > Thanks,
> > Erin
> >
> >
> > --
> > Erin Hodgess
> > Associate Professor
> > Department of Mathematical and Statistics
> > University of Houston - Downtown
> > mailto: [hidden email]
> >
> >       [[alternative HTML version deleted]]
>
> Sigh.
>
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> David Winsemius
> Alameda, CA, USA
>
>


--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: abline with zoo series

Gabor Grothendieck
In reply to this post by Erin Hodgess-2
Recessions are typically shown by shading.  The zoo package has
xblocks for this purpose.  If app1 is your zoo object then:

plot(app1)
tt <- time(app1)
xblocks(tt, tt >= "1990-07-01" & tt <= "1991-03-31",
   col = rgb(0.7, 0.7, 0.7, 0.5)) # transparent grey

See ?xblocks for more info.



On Thu, Nov 24, 2016 at 10:03 PM, Erin Hodgess <[hidden email]> wrote:

> Hello!  Happy Thanksgiving to those who are celebrating.
>
> I have a zoo series that I am plotting, and I would like to have some
> vertical lines at certain points, to indicate US business cycles.  Here is
> an example:
>
> app1 <- get.hist.quote(instrument="appl",
> start="1985-01-01",end="2016-08-31", quote="AdjClose", compression="m")
> #Fine
> plot(app1,main="Historical Stock Prices: Apple Corporation")
> #Still Fine
> #Now I want to use abline at July 1990 and March 1991 (as a start) for
> business cycles.  I tried v=67 and v="1990-07", no good.
>
> I have a feeling that it's really simple and I'm just not seeing it.
>
> Any help much appreciated.
>
> Thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: [hidden email]
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: abline with zoo series

Erin Hodgess-2
Nice!  That's perfect!

Thanks very much!

Sincerely,
Erin

On Thu, Nov 24, 2016 at 11:27 PM, Gabor Grothendieck <
[hidden email]> wrote:

> Recessions are typically shown by shading.  The zoo package has
> xblocks for this purpose.  If app1 is your zoo object then:
>
> plot(app1)
> tt <- time(app1)
> xblocks(tt, tt >= "1990-07-01" & tt <= "1991-03-31",
>    col = rgb(0.7, 0.7, 0.7, 0.5)) # transparent grey
>
> See ?xblocks for more info.
>
>
>
> On Thu, Nov 24, 2016 at 10:03 PM, Erin Hodgess <[hidden email]>
> wrote:
> > Hello!  Happy Thanksgiving to those who are celebrating.
> >
> > I have a zoo series that I am plotting, and I would like to have some
> > vertical lines at certain points, to indicate US business cycles.  Here
> is
> > an example:
> >
> > app1 <- get.hist.quote(instrument="appl",
> > start="1985-01-01",end="2016-08-31", quote="AdjClose", compression="m")
> > #Fine
> > plot(app1,main="Historical Stock Prices: Apple Corporation")
> > #Still Fine
> > #Now I want to use abline at July 1990 and March 1991 (as a start) for
> > business cycles.  I tried v=67 and v="1990-07", no good.
> >
> > I have a feeling that it's really simple and I'm just not seeing it.
> >
> > Any help much appreciated.
> >
> > Thanks,
> > Erin
> >
> >
> > --
> > Erin Hodgess
> > Associate Professor
> > Department of Mathematical and Statistics
> > University of Houston - Downtown
> > mailto: [hidden email]
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
>
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>



--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.