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