Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: automatic grid
Replies: 4   Last Post: Jun 27, 2013 6:24 AM

 Messages: [ Previous | Next ]
 Francisco Gutierrez Posts: 102 Registered: 5/31/05
Re: automatic grid
Posted: Jun 27, 2013 6:24 AM

Many thanks to David Park, Bob Hanlon and others for answering my query about coloring a grid!

Francisco
________________________________

From: Bob Hanlon <hanlonr357@gmail.com>
To: Francisco Gutierrez <fgutiers2002@yahoo.com>
Cc: MathGroup <mathgroup@smc.vnet.net>
Sent: Saturday, June 22, 2013 8:31 AM
Subject: Re: automatic grid

Aveamos1 = {"V1", "V2", "V3", "V4"};=0Aveamos2 = {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@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
>

Date Subject Author
6/22/13 Bob Hanlon
6/22/13 Bob Hanlon
6/27/13 Francisco Gutierrez