import numpy as np
import matplotlib.pyplot as plt
x1 = np.linspace(0, 1, 50)
x2 = np.linspace(0, 2, 50)
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(x1, x1, 'b--')
ax2 = ax1.twiny()
ax2.plot(x2, x2, 'go')
plt.show()
Matplotlib: one line, plotted against two related x axes in different units?