-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Milestone
Description
Bug summary
Incorrect type annotation for _AxesBase.twinx() (should be Self, not _AxesBase).
Code for reproduction
import matplotlib.pyplot as plt
import numpy as np
# First create some toy data:
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x**2)
z = np.cos(x**2)
# Create four polar Axes and access them through the returned array
fig, axsA = plt.subplots()
axsA.plot(x, y)
axsB = axsA.twinx()
axsB.plot(x, z) # <-- Cannot access attribute "plot" for class "_AxesBase"Actual outcome
axsB is of type _AxesBase
Expected outcome
The type of axsB should be the same as the type of axsA.
Matplotlib Version
3.9.1
Metadata
Metadata
Assignees
Labels
No labels