8000 [Bug]: Type hinting missing for datetime type in ax.plot and ax.errorbar · Issue #27140 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: Type hinting missing for datetime type in ax.plot and ax.errorbar #27140
Closed as not planned
@frankbolton

Description

@frankbolton

Bug summary

list of datetime passed to ax.plot results in a mypy error. The same error has been seen in ax.errorbar.

Code for reproduction

import matplotlib.pyplot as plt 
from datetime import datetime 

ax = plt.axes()

ax.plot([datetime.now()], [20.6], label="buggy")

Actual outcome

Argument 1 to "plot" of "Axes" has incompatible type "list[datetime]"; expected "Union[float, Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], str]" [arg-type]

Expected outcome

no mypy errors

Additional information

No response

Operating system

Windows 11

Matplotlib Version

3.8.0

Matplotlib Backend

TkAgg

Python version

Python 3.9.13

Jupyter version

NA

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0