# How to exclude a circle from a rectangle when drawing a contour figure?

I need to draw a contour figure defined by coordinate x and y. The domain is a rectangle (-100<=x<=100,-100<=y<=100) excluding a circle (center at the origin, and radius of 5). The object function is 'z=x+y'.

What confuses me is how to exclude the circle from the rectangle. How can I draw such a contour figure?

You can also use ConditionalExpression as the first argument of ContourPlot:

ContourPlot[ConditionalExpression[x + y, x^2 + y^2 >= 5^2],
{x, -100, 100}, {y, -100, 100},  PlotLegends -> Automatic]


ContourPlot[x + y, {x, -100, 100}, {y, -100, 100},
RegionFunction -> Function[{x, y, z}, x^2 + y^2 >= 5^2],
PlotPoints -> 100, PerformanceGoal -> "Quality",
PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"]


If the smoothness of disk bothers you (it bothers me), you can cheat it like so:

Show[ContourPlot[x + y, {x, -100, 100}, {y, -100, 100},
PlotPoints -> 100, PerformanceGoal -> "Quality",
PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"],
Graphics[{White, Disk[{0, 0}, 5]}]]


• Nice quality of the figure! Got it~ Thank you! – Robin_Lyn Nov 15 '18 at 6:07