Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Milestone
Description
Problem
Fromplot_bar.py
in the SP lecture notes, we have:
X=np.arange(n)rng=np.random.default_rng()Y1= (1-X/float(n))*rng.uniform(0.5,1.0,n)forx,yinzip(X,Y1):plt.text(x,y+0.05,f"{y:.2f}",ha="center",va="bottom")
Mypy reports typing errors:
intro/matplotlib/examples/plot_bar.py:22: error: Argument 1 to "text" has incompatible type "signedinteger[Any]"; expected "float" [arg-type]intro/matplotlib/examples/plot_bar.py:22: error: Argument 2 to "text" has incompatible type "floating[Any] | float64"; expected "float" [arg-type]intro/matplotlib/examples/plot_bar.py:25: error: Argument 1 to "text" has incompatible type "signedinteger[Any]"; expected "float" [arg-type]intro/matplotlib/examples/plot_bar.py:25: error: Argument 2 to "text" has incompatible type "floating[Any] | float64"; expected "float" [arg-type]
Proposed solution
Could we broaden the floating point & integer types accepted?