Open trenton3983 opened 3 years ago
This is the same bug as #52895 (and the other issues linked in https://github.com/pandas-dev/pandas/issues/52895#issuecomment-1859134015), the issue is actually that the pandas locators infer that dates2
is periodic and enters a different code path where it will plot the periodic time series with different units. In the second example where dates2
contains 2021-09-29
, then dates2
is no longer periodic, which inadvertently avoids the issue of pandas plotting in different units.
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[ ] I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
pandas.DataFrame.plot
to plot data with a date range span of more than one month with another data set where the date range span is less than a month, onseconday_y
, produces unexpected results in how the API formats and plots thexticks
, which results in an incorrect visualization in subplot 0.dates2
spans at least a month, the issue doesn't occur. (e.g.dates2 = ['2021-08-29', '2021-09-05', '2021-09-12', '2021-09-19', '2021-09-26', '2021-09-29']
).Expected Behavior
matplotlib.pyplot.plot
produces the correct resultInstalled Versions