# Densityplot: isolines

I'm plotting a densityplot map from interpolated data.

I need to draw lines in which the value of my function is constant (isolines), but to be constant is not the function itself but a manipulation: I plot z(x,y)=a(x)-b(x,y) the isoline is b(x,y)=costant

plotter[min_, max_, NumberOfTicks_] :=
DensityPlot[
If[S*DOS[x] < 1,
If[δ - λ > 0, δ - λ, 0.1], -1], {x,
0.02, 0.5}, {S, 0, 1}, PlotPoints -> 100,
PlotRange -> {Automatic, Automatic, {2.5, 0}},
ColorFunctionScaling -> False,
ColorFunction -> (ColorData["DeepSeaColors"][
LogarithmicScaling[#, min, max]] &),
PlotLegends ->
BarLegend[{ColorData["DeepSeaColors"], {0, 2}},
LegendMarkerSize -> 370,
Ticks -> ({LogarithmicScaling[#, min, max]} & /@ (min (max/min)^
Range[0, 2, 1/NumberOfTicks]))],
ClippingStyle -> {RGBColor["NightBlue"]}, Frame -> True,
BaseStyle -> {FontWeight -> "Bold", FontSize -> 12},
FrameLabel -> {"x", "I"}]
plotter[0.1, 3, 2]


• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) 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!
– user9660
Commented Feb 11, 2016 at 13:55
• Could you please post the definitions of your functions and any other relevant code? Commented Feb 11, 2016 at 13:56
• People here generally like users to post Mathematica code instead of descriptions, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you.
– user9660
Commented Feb 11, 2016 at 13:56
• @Iris, actually all we really need are the definitions of a[x] and b[x,y], which you've left out. Commented Feb 11, 2016 at 14:08
• But in my opinion, the general question of combining a density plot with an isoline is answered below, and doesn't really depend on the actual definitions of the functions involved. Commented Feb 11, 2016 at 14:09

It sounds to me like you want to put a contour plot of b[x,y] on top of a density plot of a[x]-b[x,y], easy enough to do

a[x_] := Sin[5 x]
b[x_, y_] := Sqrt[2 x^2 + 3 y^2 - 2 x y]
Show[
DensityPlot[a[x] - b[x, y], {x, -5, 5}, {y, -5, 5}],
ContourPlot[b[x, y], {x, -5, 5}, {y, -5, 5},
]


• @Iris, great! If you want to include only a single contour line with a given value, use something like ContourPlot[b[x, y] == 4, {x, -5, 5}, {y, -5, 5}, ContourShading -> False] Commented Feb 11, 2016 at 14:14
• Great, It works! Thank you I'm new in using mathematica
– Iris
Commented Feb 11, 2016 at 14:15
• @Iris, glad to help. If that solves it, be sure to click the check mark next to the answer so it isn't listed as an unanswered question any longer. Commented Feb 11, 2016 at 14:17
• done! I'm new on this site too. I'm really grateful!!
– Iris
Commented Feb 11, 2016 at 14:21
• great answer, but could be also combined into one plot with: DensityPlot[a[x] - b[x, y], {x, -5, 5}, {y, -5, 5}, MeshFunctions -> (b[#1, #2] &), Mesh -> 5]
– chuy
Commented Feb 11, 2016 at 16:15