You are reading an old version of the documentation (v3.1.3). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.twiny.html
Version 3.1.3
matplotlib
Fork me on GitHub

matplotlib.pyplot.twiny

matplotlib.pyplot.twiny(ax=None)[source]

Make and return a second axes that shares the y-axis. The new axes will overlay ax (or the current axes if ax is None), and its ticks will be on the top.

Examples

Plots with different scales