MathGroup Archive 2008

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

Search the Archive

Re: Color coding a Table entry

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92645] Re: Color coding a Table entry
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 9 Oct 2008 06:37:05 -0400 (EDT)

On 10/8/08 at 6:26 AM, siegman at stanford.edu (AES) wrote:

>I'm Printing (to the screen) a Table like, let's say,

>Table[{f1, f2, f3}, (x, xmin, xmax}]

>and anytime the value of f2 goes negative I want that value printed
>in Red.

>What's a simple, compact way to code this?

Define a function to color as you like. For example,

f[x_] := Style[x, Red] /; x < 0
f[x_] := x /; x >= 0

Now

Table[{f1, f@f2, f3}, (x, xmin, xmax}]

will have all negative values of f2 red and all other entries the usual col=
or.


  • Prev by Date: Re: Call Mathematica functions using C program
  • Next by Date: Re: genetic algorithms
  • Previous by thread: Re: Color coding a Table entry
  • Next by thread: Re: Color coding a Table entry