I want to create a Seaborn lineplot with below (shortened) dataframe as underlying data (Date on x axis and A and B on y axis)
Date | A | B |
---|---|---|
2024-08-01 | 48.06 | 30.9 |
2024-08-02 | 49.06 | 31.9 |
2024-08-05 | 50.06 | 32.9 |
When I create the lineplot I am getting wrong days though on the x axis (starting from 1970-01-01 and ending at 1970-01-03.
What magic trick is needed here to show the correct dates?
Many thanks as always
plot = sns.lineplot(data = df)
format_ymd = mdates.DateFormatter('%Y-%m-%d')
plot.xaxis.set_major_formatter(format_ymd)
plt.xticks(rotation=45)