# Arbitrary correspondence between vertical axes

I am doing boxed contour plots of a quantity that depends on two variables. Let's call it f[A,B]. A will go to the lower horizontal axis, and B to the left vertical axis. I would like the two remaining axes (call them C and D) to follow known rules, i.e. the right vertical will be some known function of the left vertical axis: D=D(B), and similarly for the upper horizontal axis: C=C(A). Thanks very much.

ClearAll[f, g, h]
f[x_, y_] := Cos[x] + Cos[y]
d[x_] := 5 + 2 x
c[x_] := Log[5 x]

You can use ChartingScaledTicks[{d, InverseFunction[d]}] to construct the ticks for the right axis and ChartingScaledTicks[{c, InverseFunction[c]}] for the top axis:

ContourPlot[f[x, y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
FrameTicks -> {{Automatic, ChartingScaledTicks[{d, InverseFunction[d]}][##] &},
{Automatic, ChartingScaledTicks[{c, InverseFunction[c]}][##] &}}]

• Thank you very much!
– MCV
Feb 20, 2020 at 15:03
• @MCV, my pleasure. Thank you for the accept. And welcome to mma.se.
– kglr
Feb 20, 2020 at 15:10