MathGroup Archive 2008

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

Search the Archive

Re: Conditional Plotting

  • To: mathgroup at
  • Subject: [mg85371] Re: [mg85362] Conditional Plotting
  • From: Bob Hanlon <hanlonr at>
  • Date: Thu, 7 Feb 2008 07:07:56 -0500 (EST)
  • Reply-to: hanlonr at

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