Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg104130] Re: Multi-Colored Filling in DateListPlot
  • From: Mark McClure <mcmcclur at unca.edu>
  • Date: Tue, 20 Oct 2009 04:53:00 -0400 (EDT)
  • References: <200910191114.HAA02303@smc.vnet.net>

On Mon, Oct 19, 2009 at 7:14 AM, jroge <jroge at mac.com> wrote:
> 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.

How's this:
date = {2008, 1};
duration = 16;
data = Table[FinancialData["GE",
  {date, date = DatePlus[date, {1, "Month"}]}],
  {duration}];
data = Append[Append[#[[1]], #[[2, 1]]] & /@
  Partition[data, 2, 1], Last[data]];
DateListPlot[data, Joined -> True,
  Filling -> Table[i -> {Bottom,
    If[EvenQ[i], RGBColor[1, 0, 0, 0.5],
  RGBColor[0, 0, 1, 0.5]]},
  {i, 1, duration}]]

The redefinition of data just makes things line up a
little nicer.  You can delete that line to see what I
mean.

Hope that helps,
Mark McClure


  • Prev by Date: Re: mathematica@linux, character encoding
  • Next by Date: Re: Multi-Colored Filling in DateListPlot
  • Previous by thread: Multi-Colored Filling in DateListPlot
  • Next by thread: Re: Multi-Colored Filling in DateListPlot