Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pandas/plotting/_matplotlib/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,14 @@ def use_dynamic_x(ax: Axes, index: Index) -> bool:
return index[:1].is_normalized
period = Period(index[0], freq_str)
assert isinstance(period, Period)
return period.to_timestamp().tz_localize(index.tz) == index[0]
if index.tz is not None:
# Compare naive local times directly
period_naive = period.to_timestamp()
index_naive = index[0].tz_localize(None) # Strips tz, keeps local time
return period_naive == index_naive
else:
return period.to_timestamp() == index[0]

return True


Expand Down
Loading