MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / twinx

Function twinx

lib/matplotlib/pyplot.py:2126–2139  ·  view source on GitHub ↗

Make and return a second Axes that shares the *x*-axis. The new Axes will overlay *ax* (or the current Axes if *ax* is *None*), and its ticks will be on the right. Examples -------- :doc:`/gallery/subplots_axes_and_figures/two_scales`

(ax: matplotlib.axes.Axes | None = None)

Source from the content-addressed store, hash-verified

2124
2125
2126def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
2127 """
2128 Make and return a second Axes that shares the *x*-axis. The new Axes will
2129 overlay *ax* (or the current Axes if *ax* is *None*), and its ticks will be
2130 on the right.
2131
2132 Examples
2133 --------
2134 :doc:`/gallery/subplots_axes_and_figures/two_scales`
2135 """
2136 if ax is None:
2137 ax = gca()
2138 ax1 = ax.twinx()
2139 return ax1
2140
2141
2142def twiny(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:

Callers

nothing calls this directly

Calls 2

gcaFunction · 0.85
twinxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…