Return an axes in the same location as this one but whose y axis is on the right. Mimics matplotlib.axes.Axes.twinx.

  • ylim, ymin, ymax, yreverse, yscale, ylabel, ytickdir, ygrid, ygridminor, ytickminor, yticklabeldir, ytickrange, ywraprange, yrotation, yformatter, yticklabels, yticks, ylocator, yminorticks, yminorlocator, ybounds, ymargin, ycolor, ylinewidth, yticklen, ygridcolor, ylabel_kw, yscale_kw, ylocator_kw, yformatter_kw, yminorlocator_kw (optional) – Passed to Axes.format.

  • lim, min, max, reverse, scale, label, tickdir, grid, gridminor, tickminor, ticklabeldir, tickrange, wraprange, rotation, formatter, ticklabels, ticks, locator, minorticks, minorlocator, bounds, margin, color, linewidth, ticklen, gridcolor, label_kw, scale_kw, locator_kw, formatter_kw, minorlocator_kw (optional) – Prepended with 'y' and passed to Axes.format.


This enforces the following 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.