Closed as not planned
Description
Bug summary
plt.subplots in matplotlib 3.8.0 returns tuple[Figure, Any]
, so Pylance doesn't know the type of ax
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.axes import Axes # added this
fig, ax = plt.subplots()
ax: Axes # added this
fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
colours = ['red', 'blue', 'red', 'orange']
ax.bar(fruits, counts, label=colours, color=colours)
ax.set_ylabel('fruit supply')
ax.set_title('Fruit supply by kind and color')
ax.legend(title='Fruit color')
plt.show()
Actual outcome
The intelisense does not work for ax
so it has to be explicitly typehinted.
Expected outcome
The import of Axes
and the typehint of ax
should not be required.
Additional information
please see this stackoverflow link: https://stackoverflow.com/questions/77368904/methods-and-attributes-do-not-show-when-dot-is-pressed-intellisense
Operating system
windows 11
Matplotlib Version
3.8.0
Matplotlib Backend
TkAgg
Python version
3.12
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels