MathGroup Archive 2009

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

Search the Archive

Re: Multi-Colored Filling in DateListPlot

On Mon, Oct 19, 2009 at 7:14 AM, jroge <jroge at> 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"}]}],
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

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