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 59
59
60
60
from pandas .io .formats .printing import pprint_thing
61
61
from 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
+ )
63
66
from pandas .plotting ._matplotlib .groupby import reconstruct_data_with_by
64
67
from pandas .plotting ._matplotlib .misc import unpack_single_str_list
65
68
from pandas .plotting ._matplotlib .style import get_standard_colors
@@ -1867,11 +1870,13 @@ def __init__(
1867
1870
1868
1871
MPLPlot .__init__ (self , data , ** kwargs )
1869
1872
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 ))
1875
1880
1876
1881
@cache_readonly
1877
1882
def ax_pos (self ) -> np .ndarray :
You can’t perform that action at this time.
0 commit comments