Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: Typing: broaden acceptable floats #29332

Open
@stefanv

Description

@stefanv

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp