# How to label a contour in ContourPlot with arbitrary text

I want to put a label on a contour in the ContourPlot with a text, but I can not do it. I have read all questions about this issue in the slack, but I could not find an answer to it. Let say, I want to contour plot x+y in 0 and 10 intervals of both variables, and then I choose the contour 10. Now, I want to label this contour with the text "Sommerfeld". How should I do it? this is my code:

ContourPlot[x + y, {x, 0, 10}, {y, 0, 10}, Contours -> {10}, ContourShading -> False,
ContourStyle -> {Thickness[0.006], Dashed, Red},
ContourLabels -> Text["Sommerfeld"]]

• ContourLabels takes a function or it's True/False/Automatic. So use ContourLabels -> (contourFunction[#3, {#1, #2}] &) and you should define contourFunction[c_, pos_] := Text["Sommerfeld", pos] . Note you will get the label at both ends where x+y == 10, because you added Contours->{10}. Jan 6 at 18:43
• ContourLabels -> (Rotate[ Text["Sommerfeld", {6.6, 4}, Background -> GrayLevel[0.8]], -45 Degree] &) : This is not a general solution.
– Syed
Jan 6 at 18:49
• Thank you. It worked. Jan 6 at 18:55