0

I run the below code for kind = "bar" and kind = "area" and get incorrect dates for "bar". Could this bug be confirmed and perhaps a suggestion to mitigate it?

import datetime as dt
import pandas as pd
import matplotlib.dates as mdates

kind = "bar" ### "area" works
data = {
    dt.date(2022, 10, 4): {"x": 123, "y": 234, "z": 345},
    dt.date(2022, 10, 5): {"x": 678, "y": 789, "z": 980},
    dt.date(2022, 10, 6): {"x": 987, "y": 876, "z": 765},
}
plt = pd.DataFrame(data).T.plot(
    kind = kind,
    rot = "vertical",
)
ax = plt.axes
ax.xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d"))
ax.legend(bbox_to_anchor = (1, 1))

enter image description here enter image description here

Shuri2060
  • 729
  • 6
  • 21

0 Answers0