colored box under a line graph?

3 views
Skip to first unread message

Mark Knecht

unread,
Aug 3, 2009, 7:03:53 PM8/3/09
to Bay Area R Helpers
Hi,
I'm sorry. I was sure I read how to do this about a month ago and
thought Id saved the post but I cannot find it. I've Googled around
looking for it and cannot find it. Is there an example somewhere of
how to shade a portion of the background of a line plot? I.e. - On a 5
year plot where the events on the plot go through say the spring
quarter I might want to shade the background green, summer light red,
etc.

Thanks,
Mark

Jim Porzak

unread,
Aug 3, 2009, 7:26:59 PM8/3/09
to Mark Knecht, Bay Area R Helpers
Hey Mark,

I've become a great fan of Hadley Wickham's ggplot2 over the last months. See pp 86-87 of his book for a cool example of what you want to do http://had.co.nz/ggplot2/book/

BTW, be sure to download the book's PDF as it will go away as soon as Springer's edition is out.

HTH,
Jim Porzak
Ancestry.com
San Francisco, CA
www.linkedin.com/in/jimporzak
use R! Group SF: www.meetup.com/R-Users/

Mark Knecht

unread,
Aug 3, 2009, 7:37:22 PM8/3/09
to Jim Porzak, Bay Area R Helpers
Thanks Jim. I'll do that.

Cheers,
Mark

Earl

unread,
Aug 11, 2009, 9:35:07 PM8/11/09
to Bay Area R Helpers
Mark,

Basically, you draw them with rect, probably with a transparent
color. See here for a detailed example:
http://blog.earlh.com/index.php/2009/08/shading-pieces-of-an-r-plot/

On Aug 3, 4:37 pm, Mark Knecht <markkne...@gmail.com> wrote:
> Thanks Jim. I'll do that.
>
> Cheers,
> Mark
>
>
>
> On Mon, Aug 3, 2009 at 4:26 PM, Jim Porzak<jpor...@gmail.com> wrote:
> > Hey Mark,
>
> > I've become a great fan of Hadley Wickham's ggplot2 over the last months.
> > See pp 86-87 of his book for a cool example of what you want to do
> >http://had.co.nz/ggplot2/book/
>
> > BTW, be sure to download the book's PDF as it will go away as soon as
> > Springer's edition is out.
>
> > HTH,
> > Jim Porzak
> > Ancestry.com
> > San Francisco, CA
> >www.linkedin.com/in/jimporzak
> > use R! Group SF:www.meetup.com/R-Users/
>
Reply all
Reply to author
Forward
0 new messages