# How to Increase the Number of Contour Lines (Denser) for a Specific Region?

I'm struggling to increase the number of contour lines shown on this graph, and preferably there are more contour lines between x+y==0 and x+y==2.

ContourPlot[x + y, {x, -1, 3}, {y, 0, 2}, ContourStyle -> Red, ContourShading -> False]

Neither MaxIteration nor Plotpoints seems to change the graph; there are always 5 lines shown.

Edit: with Contours I can make more equally spaced contours, but how can I make it such that it's twice as dense inside the region of x+y==0 and x+y==2 ?

• You could try Contours -> 10 or Contours -> 20 etc... and see if this does what you want. Commented Jan 19, 2021 at 7:24
• If you look at the docs for Contours, you should notice that you can specify particular $z$-values... Commented Jan 19, 2021 at 7:45

One way is use Mesh.

ContourPlot[x + y, {x, -1, 3}, {y, 0, 2}, ContourStyle -> Red,
ContourShading -> False, Contours -> 5,
MeshFunctions -> Function[{x, y}, x + y], Mesh -> {Range[1, 2, .1]},
MeshStyle -> Red]


Or

ContourPlot[x + y, {x, -1, 3}, {y, 0, 2}, ContourStyle -> Red,

• useful options for this special case PlotPoints -> 2 and MaxRecursion -> 0
• The mesh functions are powerful! The document for it in ContourPlot is quite limited, so thanks for showing how these can be done! Commented Jan 20, 2021 at 2:34