Skip to content
Merged
Changes from 2 commits
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
14 changes: 12 additions & 2 deletions pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@

from pandas.io.formats.printing import pprint_thing
from pandas.plotting._matplotlib import tools
from pandas.plotting._matplotlib.converter import register_pandas_matplotlib_converters
from pandas.plotting._matplotlib.converter import (
PeriodConverter,
register_pandas_matplotlib_converters,
)
from pandas.plotting._matplotlib.groupby import reconstruct_data_with_by
from pandas.plotting._matplotlib.misc import unpack_single_str_list
from pandas.plotting._matplotlib.style import get_standard_colors
Expand Down Expand Up @@ -1855,7 +1858,6 @@ def __init__(
self.bar_width = width
self._align = align
self._position = position
self.tick_pos = np.arange(len(data))

if is_list_like(bottom):
bottom = np.array(bottom)
Expand All @@ -1868,6 +1870,14 @@ def __init__(

MPLPlot.__init__(self, data, **kwargs)

if isinstance(data.index, ABCPeriodIndex):
self.ax.freq = data.index.freq
self.tick_pos = np.array(
PeriodConverter.convert(data.index._mpl_repr(), None, self.ax)
)
else:
self.tick_pos = np.arange(len(data))

@cache_readonly
def ax_pos(self) -> np.ndarray:
return self.tick_pos - self.tickoffset
Expand Down