Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Francisco Gutierrez

Posts: 100
Registered: 5/31/05
Re: automatic grid
Posted: Jun 27, 2013 6:24 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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
>





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.