We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52972f4 commit f0086d7Copy full SHA for f0086d7
pandas/plotting/_matplotlib/timeseries.py
@@ -251,7 +251,14 @@ def use_dynamic_x(ax: Axes, index: Index) -> bool:
251
return index[:1].is_normalized
252
period = Period(index[0], freq_str)
253
assert isinstance(period, Period)
254
- return period.to_timestamp().tz_localize(index.tz) == index[0]
+ if index.tz is not None:
255
+ # Compare naive local times directly
256
+ period_naive = period.to_timestamp()
257
+ index_naive = index[0].tz_localize(None) # Strips tz, keeps local time
258
+ return period_naive == index_naive
259
+ else:
260
+ return period.to_timestamp() == index[0]
261
+
262
return True
263
264
0 commit comments