Positioning `contour_labels` for contour plots

Folks, I am using Plots.jl with GR backend.
Basically, what I am trying to do is to draw the lines of a 2d curvilinear coordinate system.
Specifically, I do two contour plots on the same axes, that give me two sets of intersecting lines.

If I try to enable contour_labels=true for both contour plots, then everything gets very ugly.
Is there a way to adjust finely the positioning of the clabels? I mean, specify, which levels should have a label, and also specify, whether to put the label in the middle of the curve or at the edge?

Could you provide an “ugly” example?

Here is one:
ugly-plot

The position of the labels is determined per contour lot. So in principle you can’t put them on top of each other in a meaningful way. Mixing different notations for floating point numbers should of course also be avoided.

Nevertheless, something is wrong with the text positioning in this example. Therefore it would be useful to see the code.

Try Contour.jl and use any Plots backend or other plotting package. Contour.jl lets you access individual contour data, but you’ll need an algorithm to automate labeling, which doesn’t seem trivial…

A naive example using Contour.jl, Plots.jl and gr():

The GMT contour, grdcontour and contourf modules let control everything one reasonably want.

I am doing the figures for the paper, and I would like them to look uniform. And I don’t want to remake all other figures to switch to a new backend.

That is why I am asking whether there is a way for a fine control over contour_label. That is: how many labels per line, where to put them, how are they styled (provide custom clabels, adjust fontsize, etc.), disable labels for some of the levels.

Unfortunately, currently you can only specify the contour levels as an interval - discrete values are not possible. A possible workaround would be repeated calls with a single height value, but this would again cause problems regarding the positioning.

The type and size of the font, on the other hand, could be implemented with relatively little effort. But that does not solve your problem …

Discrete contour levels seem to work:

using Plots; gr(dpi=600)
f(x, y) = sin(x*y)
Plots.contour(x, y, f, contour_labels=true, levels=[-0.6, 0, 0.4])