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.
1 Answer
ClearAll[f, g, h]
f[x_, y_] := Cos[x] + Cos[y]
d[x_] := 5 + 2 x
c[x_] := Log[5 x]
You can use Charting`ScaledTicks[{d, InverseFunction[d]}]
to construct the ticks for the right axis and Charting`ScaledTicks[{c, InverseFunction[c]}]
for the top axis:
ContourPlot[f[x, y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
FrameTicks -> {{Automatic, Charting`ScaledTicks[{d, InverseFunction[d]}][##] &},
{Automatic, Charting`ScaledTicks[{c, InverseFunction[c]}][##] &}}]
-
-
$\begingroup$ @MCV, my pleasure. Thank you for the accept. And welcome to mma.se. $\endgroup$– kglrFeb 20, 2020 at 15:10