# How can I specify position of ContourLabel? [duplicate]

Consider the ContourLabeled plot:

ContourPlot[Sin[x y], {x, 0, \[Pi]}, {y, 0, \[Pi]},
Contours -> {-0.5, 0, 0.5}, ContourLabels -> All]


=>

Is it possible to specify the positions of the contour labels (e.g. if I wanted to center all the contour labels in the plot)?

Here's a hack you can use. Depending on how often you're going to need this particular functionality, I wouldn't depend on it:

Show[
ContourPlot[Sin[x y], {x, 0, \[Pi]}, {y, 0, \[Pi]}
, Contours -> {-0.5, 0, 0.5}
],
ContourPlot[Sin[x y], {x, 0, \[Pi]}, {y, 0, \[Pi]}
, Contours -> {-0.5, 0, 0.5}
, ContourLabels -> All
, RegionFunction -> Function[{x, y}, x - y > -0.05 && x - y < 0.05]
, Background -> None
]
]


This depends on the fact that MMA will place the labels in the specified region, so the second version of the plot in Show is restricted to the region defined by a small strip around the line x==y.