MathGroup Archive 2008

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

Search the Archive

Re: Conditional Plotting

f[x_, y_] := Sin[x*y];

Plot3D[f[x, y], {x, -Pi, Pi}, {y, -Pi, Pi}]

DensityPlot[Boole[f[x, y] < 0], {x, -Pi, Pi}, {y, -Pi, Pi}, 
 ColorFunction -> GrayLevel]

Since Boole is new in 5.1, use

DensityPlot[If[f[x, y] > 0, 0, 1], {x, -Pi, Pi}, {y, -Pi, Pi}, 
 ColorFunction -> GrayLevel, PlotPoints -> 100]

Bob Hanlon

---- luko <lewkow at> 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.
> Thanx

  • Prev by Date: Re: Memory and NDSolve
  • Next by Date: Re: NIntegrate - bug??
  • Previous by thread: Re: Conditional Plotting
  • Next by thread: Re: Conditional Plotting