8000 Using ginput on a plot_date plot doesn't return datetime · Issue #7462 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Using ginput on a plot_date plot doesn't return datetime #7462
Open
@dstansby

Description

@dstansby

When using ginput() on a plot made using plot_date(), the return type of the x value is float, but it should be datetime.

Minimal example:

import matplotlib.pyplot as plt
from datetime import datetime, timedelta

times = []
data = []
for i in range(0, 10):
    times.append(datetime(2016, 1, 1, 0, 0, 0) + timedelta(seconds=i))
    data.append(i)

plt.plot_date(times, data)
x = plt.ginput()
print(x[0][0])
print(type(x[0][0]))

The last statement prints "<class 'numpy.float64'>"

  • Present on 2.0.0b4+2828.g86b32ca (installed from source using pip on Linux)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0