Re: ColorFunction and/or ColorOutput - mkdk
- To: mathgroup@smc.vnet.net
- Subject: [mg10786] Re: [mg10733] ColorFunction and/or ColorOutput - mkdk
- From: Your Name <seanross@worldnet.att.net>
- Date: Thu, 5 Feb 1998 00:58:31 -0500
- References: <199802020544.AAA28161@smc.vnet.net.>
It might help to use the full parameter list of Hue, as in Plot3D[x^2 +5 y^2,{x,-2,2},{y,-3,3}, ColorFunction->(Hue[#,If[#<=.2,0,1],If[#>=.8,0,1]]&)] Note the use of parenthesis. I have found that ColorFunction likes them. Anyway, Hue[color,saturation, brightness] might give you a close enough approximation to black or white. The saturation when set to zero, gives a pretty good white. The brightness, when set to zero gives a pretty good black. decker, mark a wrote: > > I would like to color certain regions of a density plot. I have been > working with ColorFunction unsuccessfully so far. I was wondering if > someone might be able to help me without taking too much of their time. > > I would also like to clean up all the errors I am generating, by either > defining my function in a different way OR turning off a few of the > error codes. I realize there are undefined regions in the plot. > > Here it is. It was simple enough I didn't even define functions. > > cond = {alpha -> Pi/6, lambda -> 2.15, Ei -> Ep - Es} > > R = lambda Ei Sqrt[ 1 - (Ep/Ei) Sin[alpha]^2 ] > > DensityPlot[R /. cond, {Ep, 0, 6}, {Es,0,4.5}, Mesh->False, > PlotRange->{0,1}, PlotPoints->100 ] > > What I would like to do is the following: > > R<0 be black > > R=0 some bright color. > > 0<R<1 be shaded where R~0 is dark and R~1 is light. > > R>1 be white > > R undefined be some other color. > > I'm sure this is possible. And I don't need a full solution. But maybe > an example using an IF statement with ColorFunction. > > I have come pretty close so far, but the shading from dark to light is > screwed up and doesn't seem linear with R from 0 to 1. What algorithm > does GrayLevel use to normalize it with the function from 0 to 1? Does > anybody know? That might help. > > Thanks!
- References:
- ColorFunction and/or ColorOutput - mkdk
- From: "decker, mark a" <ormad@orntsrv103.micro.lucent.com>
- ColorFunction and/or ColorOutput - mkdk