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)
| 2124 | |
| 2125 | |
| 2126 | def 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 | |
| 2142 | def twiny(ax: matplotlib.axes.Axes | None = None) -> _AxesBase: |