MathGroup Archive 2009

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

Search the Archive

Re: Multi-Colored Filling in DateListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104190] Re: Multi-Colored Filling in DateListPlot
  • From: jroge <jroge at mac.com>
  • Date: Thu, 22 Oct 2009 02:20:16 -0400 (EDT)
  • References: <20214052.1255951567803.JavaMail.root@n11> <hbjtur$657$1@smc.vnet.net>

On Oct 20, 1:55 am, "David Park" <djmp... at comcast.net> wrote:
> One way to do this is with the Presentations package.
>
> Needs["Presentations`Master`"]
>
> Write routines to generate DateListPlot date iterators for each quarter o=
ver
> a span of years.
>
> Q1Iter[year1_, year2_] :=
>  Table[{"Jan 1, " <> ToString[year],
>    "Mar 31, " <> ToString[year]}, {year, year1, year2}]
> Q2Iter[year1_, year2_] :=
>  Table[{"Apr 1, " <> ToString[year],
>    "Jun 30, " <> ToString[year]}, {year, year1, year2}]
> Q3Iter[year1_, year2_] :=
>  Table[{"Jul 1, " <> ToString[year],
>    "Sep 30, " <> ToString[year]}, {year, year1, year2}]
> Q4Iter[year1_, year2_] :=
>  Table[{"Oct 1, " <> ToString[year],
>    "Dec 31, " <> ToString[year]}, {year, year1, year2}]
>
> Then just draw the quarters with their separate filling color. Use
> CustomDateTicks to label the time axis.
>
> dateticks =
>   CustomDateTicks[{{2005, 1, 1}, {2010, 1, 1}, {1, "Year"}, 4},
>    DateString[#, {"Year"}] &];
>
> Draw2D[
>  {DateListDraw[FinancialData["GE", #],
>      AxesOrigin -> {Automatic, 0},
>      Filling -> Axis,
>      FillingStyle -> Lighter@Blue,
>      Joined -> True] & /@ Join[Q1Iter[2005, 2009], Q3Iter[2005, 200=
9]],
>   DateListDraw[FinancialData["GE", #],
>      AxesOrigin -> {Automatic, 0},
>      Filling -> Axis,
>      FillingStyle -> Lighter@Red,
>      Joined -> True] & /@ Join[Q2Iter[2005, 2009], Q4Iter[2005, 200=
8]]
>   },
>  AspectRatio -> .3,
>  Frame -> True,
>  FrameTicks -> {{Automatic, Automatic}, {dateticks,
>     dateticks // NoTickLabels}},
>  PlotLabel -> Style["GE Stock Price", 14, Bold],
>  ImageSize -> 500]
>
> David Park
> djmp... at comcast.nethttp://home.comcast.net/~djmpark/ 
>
> From: jroge [mailto:jr... at mac.com]
>
> I am working on developing some financial reports and I have gotten
> stuck on using multiple colors in the filling of a DateListPlot. I
> would like to have the color of the filling alternate between blue and
> pink each quarter (or year depending on the plot) rather than a single
> color in the entire filling. Here is an example of what I am trying to
> do:
>
> http://online.wsj.com/article/SB125479559237566623.html
>
> I suspect that FillingStyle is the function I need to use, but calling
> out each quarter's (or year's) data is beyond me. Any thoughts? I have
> been using a fairly generic plot of GE stock data for exploration:
>
> DateListPlot[FinancialData["GE", "Jan. 1, 2008"], Joined -> True,
> Filling -> Bottom]
>
> Thanks,
>
> Jroge

David:

The presentations package certainly works. It does result in a white
line between some of the quarters. Also, that white line is thicker
between some quarters and others. Is that an out put or display issue
on my system or something that should be adjusted in the code?


  • Prev by Date: Re: Re: Question on Dynamic with "DockedCell"
  • Next by Date: asymptotic expansion
  • Previous by thread: Re: Multi-Colored Filling in DateListPlot
  • Next by thread: Multidimensional discrete Fourier transforms