Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Highlighting data sections with a different

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102423] Re: [mg102404] Highlighting data sections with a different
  • From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
  • Date: Sun, 9 Aug 2009 06:03:49 -0400 (EDT)
  • References: <200908080837.EAA01246@smc.vnet.net>

Hi,

what about putting the rectangle drawings directly in the DateListPlot?

ShadedDateListPlot[data_, shades_] := Module[{gr, bg, yrange},
  gr = DateListPlot[data];
  yrange = Last[PlotRange /. Last@gr];
  gr /. Graphics[g_, o_] :> 
    Graphics[
     Prepend[g, {LightGray, (Rectangle[
           Sequence @@ Transpose[{AbsoluteTime /@ #, yrange}]] &) /@ 
        shades}], o]
  ]

ShadedDateListPlot[
 FinancialData["IBM", 
  "Jan. 1, 2004"], {{{2006, 10, 15}, {2006, 12, 20}}, {{2008, 1, 
    15}, {2008, 5, 26}}}]

Cheers
Patrick

On Sat, 2009-08-08 at 04:37 -0400, Tyler wrote:
> Hello All:
> 
> I was wondering if someone could point me in the right direction on
> how to shade the background of certain regions on a plot. More
> specifically, I am interested in using DateListPlot and FinancialData
> to produce a similar economic chart as "Chart 2" found here:
> 
> http://www.economicsnapshots.com/archives/2006/snap20060705.htm
> 
> I've thought of using both "Filling" and/or "BackGround" but frankly
> have gotten nowhere. Any hints on how to approach this?
> 
> Cheers,
> 
> t.
> 
> 



  • Prev by Date: Re: Highlighting data sections with a different
  • Next by Date: Re: Export tiff problems
  • Previous by thread: Re: Re: Re: Highlighting data sections with a
  • Next by thread: Re: Highlighting data sections with a different