Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

RE: Showing a limited GrayLevel

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19101] RE: [mg18977] Showing a limited GrayLevel
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Thu, 5 Aug 1999 01:35:17 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Steve Hocter wrote:
---------------------
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.
------------------------------

Use the ColorFunction option.

Consider:
  ContourPlot[f,{x,xmin,xmax},{y,ymin,ymax}]

The setting of ColorFunction can be Automatic.  Otherwise it must be a
function as the name implies.  The range of values (f) takes on over the
points sampled are linearly mapped to the interval [0,1] and the
corresponding value for a given point in the plot is given to ColorFunction.
The ColorFunction should expect one argument (0<=arg<=1) and return either
GrayLevel[g], Hue[h,s,b], RGBColor[r,g,b], or CYMKColor[c,y,m,b].

The line below will make a ContourPlot with shades between 0.5 and 1.


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

----------------------------
If you aren't familiar with pure functions you might be more comfortable
with the following:

GrayShades[x_]:=GrayLevel[1/2 + x/2]

ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3},
    ColorFunction ->GrayShades];


----------------------------
ContourPlot and other functions in version 4 have a new option
ColorFunctionScaling.  When this option is False the function
values aren't scaled to the interval [0,1].

Regards,
Ted Ersek


  • Prev by Date: Re: POLEZERO plots
  • Next by Date: Re: Lists to mask other lists
  • Previous by thread: Re: Showing a limited GrayLevel
  • Next by thread: Re: Showing a limited GrayLevel