Skip to content
Merged
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
12 changes: 7 additions & 5 deletions pandas/plotting/_matplotlib/timeseries.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TODO: Use the fact that axis can have units to simplify the process

import functools
from typing import Optional
from typing import TYPE_CHECKING, Optional

import numpy as np

Expand All @@ -24,6 +24,10 @@
from pandas.tseries.frequencies import is_subperiod, is_superperiod
from pandas.tseries.offsets import DateOffset

if TYPE_CHECKING:
from pandas._typing import FrameOrSeries # noqa: F401


# ---------------------------------------------------------------------
# Plotting functions and monkey patches

Expand Down Expand Up @@ -188,7 +192,8 @@ def _get_freq(ax, series):
return freq, ax_freq


def _use_dynamic_x(ax, data):
def _use_dynamic_x(ax, data: "FrameOrSeries") -> bool:

freq = _get_index_freq(data)
ax_freq = _get_ax_freq(ax)

Expand All @@ -203,9 +208,6 @@ def _use_dynamic_x(ax, data):

freq = get_period_alias(freq)

if freq is None:
return False

# FIXME: hack this for 0.10.1, creating more technical debt...sigh
if isinstance(data.index, ABCDatetimeIndex):
base = get_freq_code(freq)[0]
Expand Down