You are reading an old version of the documentation (v2.1.1). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.twinx.html
matplotlib
Fork me on GitHub


Travis-CI:

This Page

matplotlib.pyplot.twinx

matplotlib.pyplot.twinx(ax=None)

Make a second axes that shares the x-axis. The new axes will overlay ax (or the current axes if ax is None). The ticks for ax2 will be placed on the right, and the ax2 instance is returned.

See also

examples/api_examples/two_scales.py
For an example