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: [mg104123] Re: Multi-Colored Filling in DateListPlot
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Tue, 20 Oct 2009 04:51:42 -0400 (EDT)
  • References: <hbhhg5$20u$1@smc.vnet.net>

jroge 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. 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]
> 
you could do that with ColorFunction, as shown below, which might not be
the fastest, but rather clear in what it does:

DateListPlot[FinancialData["GE", "Jan. 1, 2008"],
 Joined -> True,
 Filling -> Bottom,
 ColorFunction ->
  Function[{x, y},
   Switch[DateString[x, "Quarter"], "1" | "3", RGBColor[0.5, 0.5, 1],
    "2" | "4", RGBColor[0.8, 0.8, 0.8]]],
 ColorFunctionScaling -> False
 ]

hth,

albert


  • Prev by Date: Re: Multi-Colored Filling in DateListPlot
  • Next by Date: Re: Multi-Colored Filling in DateListPlot
  • Previous by thread: Re: Multi-Colored Filling in DateListPlot
  • Next by thread: Re: Multi-Colored Filling in DateListPlot