(ax: Axes, freq: BaseOffset)
| 129 | |
| 130 | |
| 131 | def _replot_ax(ax: Axes, freq: BaseOffset): |
| 132 | data = getattr(ax, "_plot_data", None) |
| 133 | |
| 134 | # clear current axes and data |
| 135 | # TODO #54485 |
| 136 | ax._plot_data = [] # type: ignore[attr-defined] |
| 137 | ax.clear() |
| 138 | |
| 139 | decorate_axes(ax, freq) |
| 140 | |
| 141 | lines = [] |
| 142 | labels = [] |
| 143 | if data is not None: |
| 144 | for series, plotf, kwds in data: |
| 145 | series = series.copy(deep=False) |
| 146 | idx = series.index.asfreq(freq, how="S") |
| 147 | series.index = idx |
| 148 | # TODO #54485 |
| 149 | ax._plot_data.append((series, plotf, kwds)) # type: ignore[attr-defined] |
| 150 | |
| 151 | # for tsplot |
| 152 | if isinstance(plotf, str): |
| 153 | from pandas.plotting._matplotlib import PLOT_CLASSES |
| 154 | |
| 155 | plotf = PLOT_CLASSES[plotf]._plot |
| 156 | |
| 157 | lines.append(plotf(ax, series.index._mpl_repr(), series.values, **kwds)[0]) |
| 158 | labels.append(pprint_thing(series.name)) |
| 159 | |
| 160 | return lines, labels |
| 161 | |
| 162 | |
| 163 | def decorate_axes(ax: Axes, freq: BaseOffset) -> None: |
no test coverage detected