MathGroup Archive 2008

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

Search the Archive

Re: Conditional Plotting


luko wrote:
> New to Mathematica..
> I would like to plot a function of x and y similar to a DensityPlot, but filled (black) if f(x,y)>0, and not filled for f(x,y)<0. 
> I use Mathematica 4.2.

Hi,

You have two choices.  Either use the ColorFunction option (something 
like DensityPlot[f[x,y], {x,-1,1}, {y,-1,1}, ColorFunction -> 
(If[#>0,Black,White]&), ColorFunctionScaling->False]), or transform you 
function so that it returns only two values: 
DensityPlot[UnitStep@f[x,y], {x,-1,1}, {y,-1,1}]


  • Prev by Date: Re: Displaying Real Numbers
  • Next by Date: Re: Using NDSolve and Finding a specific Value
  • Previous by thread: Conditional Plotting
  • Next by thread: Re: Conditional Plotting