Re: Showing a limited GrayLevel

• To: mathgroup at smc.vnet.net
• Subject: [mg19074] Re: Showing a limited GrayLevel
• From: "Atul Sharma" <atulksharma at yahoo.com>
• Date: Thu, 5 Aug 1999 01:34:59 -0400
• References: <7o5eg9\$rf1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In general, function values are scaled to the range 0-1 and then assigned a
color function based on this scaled value. This particular issue is even
more relevant if you use ColorFunction -> Hue, since the latter assigns the
red color to both a 0 and 1, making for very confusing images. The solution
in both cases is to apply an anonymous function which scales the 0-1 value
generated automatically  to only part of the range. The following function
illustrates how this works if you want to drop the range 0-0.5 in the
GrayLevel assignment. The same construct works for Hue, incidentally.

ContourPlot[Sin[x] Sin[y], {x, -2, 2}, {y, -2,
2},ColorFunction->(GrayLevel[1-#/2] &)]

Atul Sharma

PS: This is well described in Mathematica in Action, Second Edition
Stan Wagon (TELOS/Springer-Verlag, 1999), which includes the following
example using RGB Color to code the output in tones ranging from blue to
pink by varying the amount of red in the mix.

ColorFunction->(RGBColor[0.3+ 0.7 #, 0.4, 0.8]&)]

Steve Hocter wrote in message <7o5eg9\$rf1 at smc.vnet.net>...
> I have a quick question about changing the GrayLevel in contour plots.
>
> When using ContourPlot, how is it possible to limit the GrayLevel range?
>That is, instead of GrayLevel being scaled between 0 and 1, the contours
>would be shown between 0.5 and 1 cutting out any totally black parts of the
>plot.
>
> Thanks,
>
> Steve.
>
>--
>       -----------------------------------------------------------------
>       |   Steven T. Hocter                         Dept Of Maths      |
>       |   mad00 at keele.ac.uk                        Keele University   |
>       |              steve at weinstein.maths.keele.ac.uk                |
>       -----------------------------------------------------------------
>

```

• Prev by Date: HELP: Mathlink and InterpolatingFunction
• Next by Date: Re: Conversion of output
• Previous by thread: Showing a limited GrayLevel
• Next by thread: Re: Showing a limited GrayLevel