SubplotGrid.twinx(*args, **kwargs)

Add an axes locked to the same location with a distinct y axis for every axes in the grid. This builds upon matplotlib.axes.Axes.twinx.


**kwargs – Passed to CartesianAxes. You can optionally omit the y from CartesianAxes.format keywords beginning with y. For example: ax.alty(lim=(0, 10)) is equivalent to ax.alty(ylim=(0, 10)).


CartesianAxes – The resulting axes.


This enforces the following default settings:

  • Places the old y axis on the left and the new y axis on the right.

  • Makes the old right spine invisible and the new left, bottom, and top spines invisible.

  • Adjusts the y axis tick, tick label, and axis label positions according to the visible spine positions.

  • Syncs the old and new x axis limits and scales, and makes the new x axis labels invisible.