I am trying to plot a figure with two x-axis, which are non-linear to each other, with matplotlib. The plot I want to get is like this:

Basically, the age is dependent on red shift. It’s non linear and need to be calculated. I want to make both age and red shift as x-axis. How can I make it?
The function
twiny()may be what you’re looking for.