# contourlabels diagonally

I have this contour plot.

I want to place contours diagonally in the center of the plot. or put custom labels where I want. how can I do it? I use this command for contourlabels. but it is not desirable.

ContourLabels -> (Text[#3, {#3, #2}, Background -> White] &)


The plot in the picture above is obtained using the function eq defined in this answer.

• You can always put framed text to appropriate coordinates by hand (in Epilog -> Text[Framed["text",Background->White],{x, y}]). Coordinates can be computed with FindRoot as intersection diagonal line with specific contour. – Alx Dec 12 '19 at 12:34

cp = ContourPlot[Evaluate@eq[Range[10]], {Ti, 1, 1000}, {Te, 1, 150},
ContourStyle -> ColorData["IslandColors"] /@ Rescale[Range[10]],
PlotPoints -> 50];

contours = Cases[Normal@cp, l_Line, All];

intersections = RegionIntersection[#, Line[{{100, 0}, {1000, 150}}]] & /@ contours;

Show[cp,
Epilog -> MapIndexed[Text[Framed[#2[[1]], FrameStyle -> None, Background -> White,
ContentPadding -> False], #[[1, 1]]] &, intersections],
ImageSize -> 500]


• Thank you very much for your help. I really appreciate. – user68857 Dec 13 '19 at 9:02
• @user68857, you are most welcome. – kglr Dec 13 '19 at 9:13

Manual approach: make small variation of angle from main diagonal so that labels do not overlap; all numbers (300, 500, ...) are approximately taken from the figure.

SeedRandom[1234]; ang = 0.1 + RandomSample[Range[-0.04, 0.03, 0.01]];

ti = Ti /.
FindRoot[(eq[#1] /. Te -> #2 Ti) ==
0, {Ti, #3}] & @@@ (Transpose[{Range[1, 15, 2],
ang, {300, 500, 700, 800, 900, 1000, 1100, 1200}}])//Quiet

ContourPlot[Evaluate@eq[Range[15]], {Ti, 1, 2000}, {Te, 1, 200},
ContourStyle -> Black,
FrameStyle -> Directive[Black, Bold, 14, FontFamily -> "Times"],
FrameLabel -> {"\!$$\*SubscriptBox[\(T$$, $$i$$]\)(keV)",
"\!$$\*SubscriptBox[\(T$$, $$e$$]\)(keV)"}, PlotPoints -> 50,
LabelStyle -> Directive[Black, Bold, FontFamily -> "Times", 14],
Epilog -> (Text[
Style[Framed[#1, Background -> White, FrameStyle -> None,
FrameMargins -> 0], 14, FontFamily -> "Times", Bold], #2] & @@@
Transpose[{Range[1, 15, 2], Transpose[{ti, ang ti}]}])]


• Thank you very much for your help. I really appreciate. – user68857 Dec 13 '19 at 9:02