File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
pandas/plotting/_matplotlib Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 5959
6060from pandas .io .formats .printing import pprint_thing
6161from pandas .plotting ._matplotlib import tools
62- from pandas .plotting ._matplotlib .converter import register_pandas_matplotlib_converters
62+ from pandas .plotting ._matplotlib .converter import (
63+ PeriodConverter ,
64+ register_pandas_matplotlib_converters ,
65+ )
6366from pandas .plotting ._matplotlib .groupby import reconstruct_data_with_by
6467from pandas .plotting ._matplotlib .misc import unpack_single_str_list
6568from pandas .plotting ._matplotlib .style import get_standard_colors
@@ -1867,11 +1870,13 @@ def __init__(
18671870
18681871 MPLPlot .__init__ (self , data , ** kwargs )
18691872
1870- self .tick_pos = (
1871- np .array (self .ax .xaxis .convert_units (self ._get_xticks ()))
1872- if isinstance (data .index , ABCPeriodIndex )
1873- else np .arange (len (data ))
1874- )
1873+ if isinstance (data .index , ABCPeriodIndex ):
1874+ self .ax .freq = data .index .freq
1875+ self .tick_pos = np .array (
1876+ PeriodConverter .convert (data .index ._mpl_repr (), None , self .ax )
1877+ )
1878+ else :
1879+ self .tick_pos = np .arange (len (data ))
18751880
18761881 @cache_readonly
18771882 def ax_pos (self ) -> np .ndarray :
You can’t perform that action at this time.
0 commit comments