MathGroup Archive 2005

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

Search the Archive

Re: ArrayPlot: ColorRules v. ColorFunction


Bruce Colletti wrote:
> Re Mathematica 5.1 under WinXP.
> 
> T is a 5x5 matrix of numbers.
> 
> Using ArrayPlot, how would I display the colored array, where entries in [0, 0.3], (0.3,0.5] and (0.5,1] are Red, White and Blue respectively (default color is green for values outside [0,1])?  
> 
> Thanks.
> 
> Bruce
> 
Hi Bruce,

You must to define your own color function as in the following line

In[1]:=
ArrayPlot[T, ColorFunction ->
     (Which[0 <= #1 <= 0.3, Red,
           0.3 < #1 <= 0.5, White,
           0.5 < #1 <= 1, Blue,
           True, Green] & )];

Best regards,
/J.M.


  • Prev by Date: Re: ArrayPlot: ColorRules v. ColorFunction
  • Next by Date: Re: ArrayPlot: ColorRules v. ColorFunction
  • Previous by thread: Re: ArrayPlot: ColorRules v. ColorFunction
  • Next by thread: Re: ArrayPlot: ColorRules v. ColorFunction