MathGroup Archive 2009

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

Search the Archive

Re: BarChart3D Coloring Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105568] Re: [mg105547] BarChart3D Coloring Problem
  • From: Brett Champion <brettc at wolfram.com>
  • Date: Wed, 9 Dec 2009 05:43:59 -0500 (EST)
  • References: <200912081144.GAA29202@smc.vnet.net>

On Dec 8, 2009, at 5:44 AM, Don wrote:

> Given an array of random numbers (called Pct. Utilization)  in the
> range 0 to 1.0 ,
> and displayed using BarChart3D, is there a way to color the bars so
> that the part
> of any bar that is above a certain threshold (say 0.75)  is uniformly
> in  one color (e.g. Green)?
>
> For e..g , Below is an example of a typical Bar Chart of Pct.
> Utilization
>
> percents = Table[Random[], {5}, {10}];
>
> BarChart3D[percents, ChartLayout -> "Grid",
>  AxesLabel -> {Style["trPeriod", Bold, 14 ],
>   Style["Traffic", Bold, 14], Style["Pct. Utilization", Bold, 14]}
>  ]
>
> Each bar above a threshold of 0.75 should have that portion of the bar
> above 0.75 colored in Green.
>

thresholdBar[{xrange_, yrange_, {z0_, z1_}},
   rest__] :=
  {ChartElementData["Cube"][{xrange, yrange, {z0, Min[z1, 0.75]}},
     rest],
   If[z1 >= 0.75,
    {Green, ChartElementData["Cube"][{xrange, yrange, {0.75, z1}},  
rest]},
    {}
    ]}

BarChart3D[percents, ChartLayout -> "Grid",
  AxesLabel -> {Style["trPeriod", Bold, 14], Style["Traffic", Bold, 14],
    Style["Pct. Utilization", Bold, 14]},
  ChartElementFunction -> thresholdBar]

> Is there a way of doing this?
>
> If not, there is a fall back position that would convey nearly as
> much  information by
> coloring all of a bar (from 0 to the top of the bar) that exceeded a
> certain threshold entirely in one  color (again, e.g. Green)  for all
> those bars that exceed 0.75.
>
> Thank you in advance for any help you can give me.
>
> Don
>



  • Prev by Date: Re: Buttons and Overwriting a Cell
  • Next by Date: would like to compute a tensor derivative of a function and evaluate
  • Previous by thread: BarChart3D Coloring Problem
  • Next by thread: Connecting JLink from Linux to a Mac kernel