Unexpected output in ContourPlot

ContourPlot[Boole[(Im[x+ I y]!=0&&Re[x+I y]<=-1)||Re[x+I y]>-1],{x,-5,1},{y,-5,5}, PlotPoints->200]


shows two white lines, the horizontal ray from -infinity to -1, and a vertical line at Re(z)=-1. The ray is correct, but I think the vertical line is wrong. Check with a sample at (-1,2):

Im[x+ I y]=!=0/.x->-1/.y->2
Re[x+ I y]<=1/.x->-1/.y->2
Boole[(Im[x+ I y]!=0&&Re[x+I y]<=-1)||Re[x]>-1]/.x->-1/.y->2


gives me True and True and 1, as expected as is correct.

So the left condition is also True, which means the points on the vertical line shouldn't be white but blue.

I know there can be sampling errors with these types of plots, but it got the horizontal ray so nicely that I didn't expect it show such a spurious white vertical line.

Sampling problems is why I don't use a RegionPlot here, because it does, indeed, miss the ray, which is easily explainable and perhaps somewhat expected. I've used ContourPlot with Boole successfully before, so I am surprised to see the false negatives on the vertical line. How can there be white if the Boole[...] is 1 on that vertical line?

Update a day later:

I can get the white vertical line to disappear with

ComplexContourPlot[Boole[(Arg[z]<Pi&&Re[z]<=-1)||Re[z]>-1],{z,5},PlotPoints->200]
ComplexContourPlot[Boole[(Arg[z]<Pi)||Re[z]>-1],{z,5},PlotPoints->200]


but a) it shouldn't be necessary to do that, and b) now the segment between (-1,0) and (0,0) is still white, although it should be blue. The white ray should only be (-infinity, -1), not the whole negative real axis.

• Do you mean Re[x + I*y] > -1 instead of Re[x]>-1? Oct 1, 2023 at 6:12
• The same issue with ComplexContourPlot[ Boole[(Im[z] != 0 && Re[z] <= -1) || Re[z] > -1], {z, 5}]. Oct 1, 2023 at 6:19
• @user64494, thank you, corrected, but same result: white vertical line Oct 1, 2023 at 17:39

First, writing Re[x+ I y] is superfluous, simply write x. The some for Im[...].

(y != 0 && x <= -1) || x > -1


This says: the whole real plane with the exception of the line (-Infinity,-1]. This is an infinite thine line. MMA indicates this correctly by a white line.

However, MMA gets it wrong when it combines the 2 pieces:

(y != 0 && x <= -1) and x > -1

There is no dividing line here. Nevertheless MMA draws one like it were:

(y != 0 && x < -1) and x > -1

Maybe you want report this to: [email protected]

Note also, that you can eliminate these white lines by specifying: "Exclusions->None"

• Hmmmm, a) the ray is (-infinity, -1), not (-infinity, 0), b) I do want to show the white line for the ray, that is the horizontal line. The whole point of the graphic is to show that it's blue everywhere in the complex plane except for that ray. I don't want to eliminate all lines, just the "invalid" one at Re(z)=-1. c) I'm sure you mean wolfram.com, not wolfrasm.com :) Oct 1, 2023 at 19:09
• Sure, you are right: (-Infinity,-1] Oct 1, 2023 at 19:26