You are reading an old version of the documentation (v3.1.0). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.twinx.html
Version 3.1.0
matplotlib
Fork me on GitHub

Table of Contents

matplotlib.axes.Axes.twinx

Axes.twinx(self)

Create a twin Axes sharing the xaxis

Create a new Axes instance with an invisible x-axis and an independent y-axis positioned opposite to the original one (i.e. at right). The x-axis autoscale setting will be inherited from the original Axes. To ensure that the tick marks of both y-axes align, see LinearLocator

Returns:
ax_twin : Axes

The newly created Axes instance

Notes

For those who are 'picking' artists while using twinx, pick events are only called for the artists in the top-most axes.

Examples using matplotlib.axes.Axes.twinx