• To: mathgroup at yoda.physics.unc.edu (Mathematica mailing list)
• From: msdrl!nachbar at uunet.uu.net (Dr. Robert B. Nachbar)
• Date: Fri, 22 Jan 93 8:36:53 EDT

```well, after i sent that cry for help yesterday, i dickered around some
more with the options to ContourPlot. it turns out that the thing to do
is to use the ColorFunction option:

In[1]:= reverseGrayLevel[x_]:=GrayLevel[1-x] ;

In[2]:= ContourPlot[(1-Sin[x])(2-Cos[2 y]), {x,-2,2},{y,-2,2},
ColorFunction->reverseGrayLevel] ;

which does the trick! in fact, i was so captivated by my success that i
put together the following package to make using color gradients easy:

------------------cut here----------------------
(* Copyright 1992 Merck & Co., Inc. *)

(*:Author: Robert B. Nachbar *)

(*:Version: Mathematica 2.1 *)

(*:Keywords:
*)

(*:Sources: none. *)

(*:Requirements: none. *)

(*:Warnings: none. *)

(*:Summary: This package contains functions that produce color
gradients for use with the ColorFunction option.
*)

ReverseGrayLevel::usage = "ReverseGrayLevel[z] produces a gray scale
that goes from white to black as the argument goes from 0 to 1."

that goes from white to red as the argument goes from 0 to 1."

that goes from white to green as the argument goes from 0 to 1."

that goes from white to blue as the argument goes from 0 to 1."

that goes from white to cyan as the argument goes from 0 to 1."

that goes from white to magenta as the argument goes from 0 to 1."

that goes from white to yellow as the argument goes from 0 to 1."

Begin["`Private`"]

ReverseGrayLevel[x_] := GrayLevel[1-x]

CyanGradient[x_] := RGBColor[1-x, 1, 1] ;

MagentaGradient[x_] := RGBColor[1, 1-x, 1] ;

YellowGradient[x_] := RGBColor[1, 1, 1-x] ;

End[]

EndPackage[]
------------------cut here----------------------
one can even make gradient that blend from one color into another!

happy plotting!

bob
--
Dr. Robert B. Nachbar | Merck Research Laboratories | 908/594-7795
nachbar at msdrl.com     | R50S-100                    | 908/594-4224 FAX
| PO Box 2000                 |
| Rahway, NJ 07065            |

```

• Prev by Date: Series is taking too long
• Next by Date: test for "evenness" and "oddness"
• Previous by thread: Re: Series is taking too long
• Next by thread: test for "evenness" and "oddness"