I would like to be able to format a secondary axis different to the first x axis. This is a minimal example of what I have now:
However, it is not as clear as I want it to be. Since the secondary axis represent a length, I would like it to be in scalar notation (1, 10, 100) instead of the logarithm notation. (The first axis could be either, but the 10^x notation is probably clearer there).
I know how do to it for a singular axis, but it seems that the SecondaryAxis class rewrite the ticks if I set them. How can I do it/make sure that my edit are taken into account ?
This is the minimal code to reproduce the example:
import matplotlib.pyplot as plt fig, ax1 = plt.subplots(1, 1, constrained_layout=True) ax1.semilogx([1e-4, 1e-3, 1e-2, 1e-1], [1, 0.7, 0.3, 0.0]) ax1.set_xlabel("First x axis") ax1.set_xlim([2e-5, 0.05]) ax1.set_ylim([0,1.0]) def func(T): return T*1000*3.72*2 def invfunc(d): return d/(1000*3.72*2) secax = ax1.secondary_xaxis(-0.2, functions=(func,invfunc)) secax.set_xlabel("Second x axis")