# Plotting the sign of a two-variables function

I have a continous function f(x,y), and I want the 2D plot of its sign. I then created a function

sign=Sign[f]


and used ContourPlot: what I obtained is this graph where the blue region corresponds to -1 and the yellow region to 1. Can I get rid of the white region? It does not depend on the function, as there are points in it with -1 or 1 sign.

EDIT: the exact expression of f, in its original variables h and mu, is

1/mu^4*( 0.0562706 (-0.308221 + Sqrt[0.1 + h + mu]) (-2.01155 +
1. Sqrt[0.1 + h + mu]) (-0.324443 - 3.24443 h - 11.7611 mu +
1. Sqrt[0.1 + h + mu]) (-0.049713 - 0.49713 h - 1.8021 mu +
1. Sqrt[0.1 + h + mu]) (-0.0431301 - 0.431301 h + 1. mu -
0.737425 Sqrt[0.1 + h + 1.09109 mu]) (-0.0431301 - 0.431301 h +
1. mu + 0.133495 Sqrt[0.1 + h + 1.09109 mu]) (-0.309516 + Sqrt[
0.1 + h + 1.09109 mu]) (1.70977 + 1. Sqrt[0.1 + h + 1.09109 mu]))

• Welcome to Mathematica.SE, Ire! I suggest the following: 1) Take the tour and check the faqs. 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Mar 4 at 16:09
• Could you add the definition of your function f? Mar 4 at 16:09
• Hi, thank you for your interest! The exact expression of f is very long, but I'm about to copypaste it in the question.
– Ire
Mar 4 at 16:40
• I think you'll find RegionPlot more useful here since ContourPlot works best with continuous functions. Mar 4 at 17:25
• @bills Yes, actually in my plot mu starts from 0.1.
– Ire
Mar 4 at 17:43

Add the options PlotRange -> All and Exclusions -> None:

ContourPlot[Sign[f[h, mu]], {h, 0, 100}, {mu, 0, 20},
Contours -> {{0}}, ContourStyle -> Red, PlotPoints -> 100,
PlotRange -> All, Exclusions -> None] With your data, I get a complete different plot. For clarity., I only plot the zero contour:

f[h_, mu_] :=
1/mu^4*(0.0562706 (-0.308221 + Sqrt[0.1 + h + mu]) (-2.01155 +
1. Sqrt[0.1 + h + mu]) (-0.324443 - 3.24443 h - 11.7611 mu +
1. Sqrt[0.1 + h + mu]) (-0.049713 - 0.49713 h - 1.8021 mu +
1. Sqrt[0.1 + h + mu]) (-0.0431301 - 0.431301 h + 1. mu -
0.737425 Sqrt[0.1 + h + 1.09109 mu]) (-0.0431301 -
0.431301 h + 1. mu +
0.133495 Sqrt[0.1 + h + 1.09109 mu]) (-0.309516 +
Sqrt[0.1 + h + 1.09109 mu]) (1.70977 +
1. Sqrt[0.1 + h + 1.09109 mu])) // Simplify;

ContourPlot[f[h, mu] == 0, {h, 0, 100}, {mu, 0, 20},
FrameLabel -> {"h", "mu"}, ContourLabels -> Automatic] • You're totally right, I modified the image which now matches with yours.
– Ire
Mar 4 at 17:42

Or RegionPlot

RegionPlot[{f[h, mu] < 0, f[h, mu] > 0}, {h, 0, 100}, {mu, 0, 20},
FrameLabel -> {"h", "mu"}, PlotPoints -> 200,
PlotStyle -> {Red, Green}, BoundaryStyle -> Yellow] • Yes, also RegionPlot works great!
– Ire
Mar 5 at 14:41