Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*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 1998

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

Search the Archive

Re: ColorFunction and/or ColorOutput - mkdk



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!



  • Prev by Date: Re: optimize
  • Next by Date: Re: an spanish student...
  • Prev by thread: ColorFunction and/or ColorOutput - mkdk
  • Next by thread: Re: ColorFunction and/or ColorOutput - mkdk