# DensityPlot help

I currently have this code,

psi = a (Sin[2*Pi*x] Sin[3*Pi*y] + .5 Sin[3*Pi*x] Sin[2*Pi*y]);
psip = Abs[psi]^2;
psipp = Integrate[psip, {x, 0, 2}, {y, 0, 2}]
Solve[psipp == 1, a, Reals]
b = 0.894427;
psii = b (Sin[2*Pi*x] Sin[3*Pi*y] + .5 Sin[3*Pi*x] Sin[2*Pi*y]);
DensityPlot[psii, {x, 0, 2}, {y, 0, 2}, ColorFunction -> "Rainbow",
PlotLegends -> Automatic,
PlotRange -> {Automatic, Automatic, {-5, 5}}]


I now want the density plot to only show where my zeros are and positive and negative numbers. Like if its zero the color would be black, if positive, green, and if negative, red. Something like that. Does any one know how I would go about getting this done?

Thank you

• Did you check ContourPlot? Note that you are not using psip, psipp and Solve[...] so there no need to overcomplicate the question. – anderstood Feb 21 '18 at 1:30

b = 0.894427;
psii = b (Sin[2*Pi*x] Sin[3*Pi*y] + .5 Sin[3*Pi*x] Sin[2*Pi*y]);


### DensityPlot

DensityPlot[psii, {x, 0, 2}, {y, 0, 2},
PlotLegends -> BarLegend[{{Red, Green}, {-2, 2}}, {-2, 0, 2}],
PlotRange -> {Automatic, Automatic, {-5, 5}},
MeshFunctions -> Function[{x, y}, psii], Mesh -> {{0}},
MeshStyle -> Directive[Thick, Black], PlotPoints -> 100,

ContourPlot[psii, {x, 0, 2}, {y, 0, 2},

• Is there a reason why there is aliasing with DensityPlot? – anderstood Feb 21 '18 at 2:13