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

MathGroup Archive 2013

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

Search the Archive

Re: automatic grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131266] Re: automatic grid
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 22 Jun 2013 20:44:48 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20130622073308.6B8D46A0A@smc.vnet.net>

The definition of color in the second example should read

Clear[color];
color[x_?NumericQ] :=
  Style[x, If[x > 10, Red,
    If[x > 5, Green, Blue]], 16];
color[x_] := Style[x, 16];


Bob Hanlon



On Sat, Jun 22, 2013 at 9:31 AM, Bob Hanlon <hanlonr357 at gmail.com> wrote:

> Aveamos1 = {"V1", "V2", "V3", "V4"};
> veamos2 = {5, 20, 7, 11};
>
>
> Clear[color];
> color[x_?NumericQ] := Style[x, If [x > 10, Red, Black] , 16];
> color[x_] := Style[x, 16];
>
>
> Grid[{Aveamos1, color /@ veamos2}]
>
>
> Clear[color];
> color[x_?NumericQ] :=
>   Style[x, If[x > 10, Red,
>     If[x > 5, Green, Blue]], 16];
> color[x_] := x;
>
>
> Grid[{Aveamos1, color /@ veamos2}]
>
>
>
> Bob Hanlon
>
>
>
>
> On Sat, Jun 22, 2013 at 3:33 AM, Francisco Gutierrez <
> fgutiers2002 at yahoo.com> wrote:
>
>>
>> Dear Group:
>> I have a grid (in reality, a collection of grids) and would like to make
>> Mathematica give each entry of the grid a style depending on its value.
>> For example:
>> Aveamos1= {"V1","V2",V3", "V4"}
>> veamos2={5,20,7,11}
>> Grid[{veamos1,veamos2}]
>> Suppose that I want any value above 10 to be coloured in red. How can I
>> manage to do this?
>> Thanks
>> Francisco
>>
>>
>




  • References:
  • Prev by Date: Re: automatic grid
  • Next by Date: Re: automatic grid
  • Previous by thread: Re: automatic grid
  • Next by thread: Re: automatic grid