# List Contour Plot: Delete some contour lines, but keep the colors

I'm trying to make a ContourPlot of a set of data of the kind: $(x,y,f(x,y))$

What I'd like to do is to remove the majority of the iso-line and just leave two of them, but keeping the changing of the color.

In other words I'd like to obtain something like a ListDensityPlot of my data set, but with two iso-curves marking the points $(x,y)$ having either value $0$ or $-0.0005$.

Any idea on how to do this? like for example overlapping two different graphs on each other or extracting the iso-curve interpolant from the contour plot and plug it into the density plot? these are just some ideas...

• "ContourStyle → $\{g_1, g_2, \ldots\}$ specifies that successive directives $g_i$ should be used to draw successive contours." So, for example, Contours -> {0, 0.1, 0.2, 0.5}, ContourStyle -> {Black, None, None, Black}.
– user484
Dec 31, 2014 at 18:11
• You could also Show a ListContourPlot with just the contours you want (and ContourShading -> None) on top of a ListDensityPlot.
– user484
Dec 31, 2014 at 18:14
• this seems a very nice idea! Dec 31, 2014 at 18:17

data = Table[Sin[i + j^2], {i, 0, 3, 0.05}, {j, 0, 3, 0.05}];

ListContourPlot[data, ColorFunction -> "Rainbow",
Contours -> {{0, {Thick, Black}}, {-.5, {Thick, Dashed, Black}},
Sequence @@ ({#, None} & /@ Range[Min@data, Max@data, .0025])}]


You can also use the desired contours as Epilog with ListDensityPlot:

lcp = ListContourPlot[data, ContourShading -> None,
Contours -> {{0, {Thick, Black}}, {-.5, {Thick, Dashed, Black}}}];
ListDensityPlot[data, ColorFunction -> "Rainbow", Epilog -> lcp[[1]]]


Or, to use default contour styles, use Contours -> {0, -.5} in lcp to get

ListDensityPlot[data, ColorFunction -> "Rainbow", Epilog -> lcp[[1]]]


Update: You can also use Mesh and MeshFunctions with ListDensityPlot:

ListDensityPlot[data, ColorFunction -> "Rainbow", MeshFunctions -> {#3 &},  Mesh -> {{0., -.5}}]