MathGroup Archive 2008

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

Search the Archive

Re: Conditional Plotting

  • To: mathgroup at
  • Subject: [mg85368] Re: Conditional Plotting
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Thu, 7 Feb 2008 06:33:21 -0500 (EST)
  • References: <foeknc$iae$>

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.


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