From eaf911f7b9960e5f605396b4a80262f155c9d768 Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 7 Nov 2023 17:38:22 -0800 Subject: [PATCH 1/9] TYP: _iter_data --- pandas/plotting/_matplotlib/boxplot.py | 3 +-- pandas/plotting/_matplotlib/core.py | 26 ++++++++++++-------------- pandas/plotting/_matplotlib/groupby.py | 4 +--- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/pandas/plotting/_matplotlib/boxplot.py b/pandas/plotting/_matplotlib/boxplot.py index e6481aab50f6e..62e8e62301ede 100644 --- a/pandas/plotting/_matplotlib/boxplot.py +++ b/pandas/plotting/_matplotlib/boxplot.py @@ -240,8 +240,7 @@ def _make_plot(self, fig: Figure) -> None: self.maybe_color_bp(bp) self._return_obj = ret - labels = [left for left, _ in self._iter_data()] - labels = [pprint_thing(left) for left in labels] + labels = [pprint_thing(left) for left in self.data.columns] if not self.use_index: labels = [pprint_thing(key) for key in range(len(labels))] _set_ticklabels( diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index b67a8186c8c2b..c27abea496a94 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -7,6 +7,7 @@ from collections.abc import ( Hashable, Iterable, + Iterator, Sequence, ) from typing import ( @@ -431,17 +432,13 @@ def _validate_color_args(self): ) @final - def _iter_data(self, data=None, keep_index: bool = False, fillna=None): - if data is None: - data = self.data - if fillna is not None: - data = data.fillna(fillna) - + @staticmethod + def _iter_data(data: DataFrame) -> Iterator[tuple[Hashable, np.ndarray]]: for col, values in data.items(): - if keep_index is True: - yield col, values - else: - yield col, values.values + # This was originally written to use values.values before EAs + # were implemented; adding np.asarray(...) to keep consistent + # typing. + yield col, np.asarray(values.values) @property def nseries(self) -> int: @@ -1404,14 +1401,14 @@ def _make_plot(self, fig: Figure) -> None: x = data.index # dummy, not used plotf = self._ts_plot - it = self._iter_data(data=data, keep_index=True) + it = data.items() else: x = self._get_xticks(convert_period=True) # error: Incompatible types in assignment (expression has type # "Callable[[Any, Any, Any, Any, Any, Any, KwArg(Any)], Any]", variable has # type "Callable[[Any, Any, Any, Any, KwArg(Any)], Any]") plotf = self._plot # type: ignore[assignment] - it = self._iter_data() + it = self._iter_data(data=self.data) stacking_id = self._get_stacking_id() is_errorbar = com.any_not_none(*self.errors.values()) @@ -1749,7 +1746,8 @@ def _make_plot(self, fig: Figure) -> None: pos_prior = neg_prior = np.zeros(len(self.data)) K = self.nseries - for i, (label, y) in enumerate(self._iter_data(fillna=0)): + data = self.data.fillna(0) + for i, (label, y) in enumerate(self._iter_data(data=data)): ax = self._get_ax(i) kwds = self.kwds.copy() if self._is_series: @@ -1907,7 +1905,7 @@ def _make_plot(self, fig: Figure) -> None: colors = self._get_colors(num_colors=len(self.data), color_kwds="colors") self.kwds.setdefault("colors", colors) - for i, (label, y) in enumerate(self._iter_data()): + for i, (label, y) in enumerate(self._iter_data(data=self.data)): ax = self._get_ax(i) if label is not None: label = pprint_thing(label) diff --git a/pandas/plotting/_matplotlib/groupby.py b/pandas/plotting/_matplotlib/groupby.py index 00c3c4114d377..75b2bbf4d8750 100644 --- a/pandas/plotting/_matplotlib/groupby.py +++ b/pandas/plotting/_matplotlib/groupby.py @@ -126,9 +126,7 @@ def reconstruct_data_with_by( return data -def reformat_hist_y_given_by( - y: Series | np.ndarray, by: IndexLabel | None -) -> Series | np.ndarray: +def reformat_hist_y_given_by(y: np.ndarray, by: IndexLabel | None) -> np.ndarray: """Internal function to reformat y given `by` is applied or not for hist plot. If by is None, input y is 1-d with NaN removed; and if by is not None, groupby From 48865f46a851f308dfa8a28116cc7931bfee37e0 Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 7 Nov 2023 17:56:39 -0800 Subject: [PATCH 2/9] TYP: plotting --- pandas/plotting/_matplotlib/boxplot.py | 11 ++++++----- pandas/plotting/_matplotlib/core.py | 23 ++++++++++++++++------- pandas/plotting/_matplotlib/hist.py | 12 ++++++------ 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/pandas/plotting/_matplotlib/boxplot.py b/pandas/plotting/_matplotlib/boxplot.py index 62e8e62301ede..969135822791f 100644 --- a/pandas/plotting/_matplotlib/boxplot.py +++ b/pandas/plotting/_matplotlib/boxplot.py @@ -93,17 +93,18 @@ def __init__(self, data, return_type: str = "axes", **kwargs) -> None: # error: Signature of "_plot" incompatible with supertype "MPLPlot" @classmethod def _plot( # type: ignore[override] - cls, ax: Axes, y, column_num=None, return_type: str = "axes", **kwds + cls, ax: Axes, y: np.ndarray, column_num=None, return_type: str = "axes", **kwds ): + ys: np.ndarray | list[np.ndarray] if y.ndim == 2: - y = [remove_na_arraylike(v) for v in y] + ys = [remove_na_arraylike(v) for v in y] # Boxplot fails with empty arrays, so need to add a NaN # if any cols are empty # GH 8181 - y = [v if v.size > 0 else np.array([np.nan]) for v in y] + ys = [v if v.size > 0 else np.array([np.nan]) for v in ys] else: - y = remove_na_arraylike(y) - bp = ax.boxplot(y, **kwds) + ys = remove_na_arraylike(y) + bp = ax.boxplot(ys, **kwds) if return_type == "dict": return bp, bp diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index c27abea496a94..aa7d584ba267e 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -1448,7 +1448,14 @@ def _make_plot(self, fig: Figure) -> None: # error: Signature of "_plot" incompatible with supertype "MPLPlot" @classmethod def _plot( # type: ignore[override] - cls, ax: Axes, x, y, style=None, column_num=None, stacking_id=None, **kwds + cls, + ax: Axes, + x, + y: np.ndarray, + style=None, + column_num=None, + stacking_id=None, + **kwds, ): # column_num is used to get the target column from plotf in line and # area plots @@ -1475,7 +1482,7 @@ def _ts_plot(self, ax: Axes, x, data: Series, style=None, **kwds): decorate_axes(ax.right_ax, freq, kwds) ax._plot_data.append((data, self._kind, kwds)) - lines = self._plot(ax, data.index, data.values, style=style, **kwds) + lines = self._plot(ax, data.index, np.asarray(data.values), style=style, **kwds) # set date formatter, locators and rescale limits # error: Argument 3 to "format_dateaxis" has incompatible type "Index"; # expected "DatetimeIndex | PeriodIndex" @@ -1503,7 +1510,9 @@ def _initialize_stacker(cls, ax: Axes, stacking_id, n: int) -> None: @final @classmethod - def _get_stacked_values(cls, ax: Axes, stacking_id, values, label): + def _get_stacked_values( + cls, ax: Axes, stacking_id: int | None, values: np.ndarray, label + ) -> np.ndarray: if stacking_id is None: return values if not hasattr(ax, "_stacker_pos_prior"): @@ -1523,7 +1532,7 @@ def _get_stacked_values(cls, ax: Axes, stacking_id, values, label): @final @classmethod - def _update_stacker(cls, ax: Axes, stacking_id, values) -> None: + def _update_stacker(cls, ax: Axes, stacking_id: int | None, values) -> None: if stacking_id is None: return if (values >= 0).all(): @@ -1601,7 +1610,7 @@ def _plot( # type: ignore[override] cls, ax: Axes, x, - y, + y: np.ndarray, style=None, column_num=None, stacking_id=None, @@ -1727,7 +1736,7 @@ def _plot( # type: ignore[override] cls, ax: Axes, x, - y, + y: np.ndarray, w, start: int | npt.NDArray[np.intp] = 0, log: bool = False, @@ -1860,7 +1869,7 @@ def _plot( # type: ignore[override] cls, ax: Axes, x, - y, + y: np.ndarray, w, start: int | npt.NDArray[np.intp] = 0, log: bool = False, diff --git a/pandas/plotting/_matplotlib/hist.py b/pandas/plotting/_matplotlib/hist.py index fd0dde40c0ab3..a2ab1c9409841 100644 --- a/pandas/plotting/_matplotlib/hist.py +++ b/pandas/plotting/_matplotlib/hist.py @@ -101,7 +101,7 @@ def _calculate_bins(self, data: DataFrame, bins) -> np.ndarray: def _plot( # type: ignore[override] cls, ax: Axes, - y, + y: np.ndarray, style=None, bottom: int | np.ndarray = 0, column_num: int = 0, @@ -166,7 +166,7 @@ def _make_plot(self, fig: Figure) -> None: self._append_legend_handles_labels(artists[0], label) - def _make_plot_keywords(self, kwds: dict[str, Any], y) -> None: + def _make_plot_keywords(self, kwds: dict[str, Any], y: np.ndarray) -> None: """merge BoxPlot/KdePlot properties to passed kwds""" # y is required for KdePlot kwds["bottom"] = self.bottom @@ -225,7 +225,7 @@ def __init__( self.weights = weights @staticmethod - def _get_ind(y, ind): + def _get_ind(y: np.ndarray, ind): if ind is None: # np.nanmax() and np.nanmin() ignores the missing values sample_range = np.nanmax(y) - np.nanmin(y) @@ -248,12 +248,12 @@ def _get_ind(y, ind): def _plot( # type: ignore[override] cls, ax: Axes, - y, + y: np.ndarray, style=None, bw_method=None, ind=None, column_num=None, - stacking_id=None, + stacking_id: int | None = None, **kwds, ): from scipy.stats import gaussian_kde @@ -265,7 +265,7 @@ def _plot( # type: ignore[override] lines = MPLPlot._plot(ax, ind, y, style=style, **kwds) return lines - def _make_plot_keywords(self, kwds: dict[str, Any], y) -> None: + def _make_plot_keywords(self, kwds: dict[str, Any], y: np.ndarray) -> None: kwds["bw_method"] = self.bw_method kwds["ind"] = self._get_ind(y, ind=self.ind) From 3aecf97507735f6e93b5316da9895699a22dba25 Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 7 Nov 2023 19:13:13 -0800 Subject: [PATCH 3/9] TYP: plotting --- pandas/plotting/_matplotlib/boxplot.py | 2 +- pandas/plotting/_matplotlib/core.py | 26 ++++++++++++++++++++------ pandas/plotting/_matplotlib/hist.py | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pandas/plotting/_matplotlib/boxplot.py b/pandas/plotting/_matplotlib/boxplot.py index 969135822791f..37ebd940f3646 100644 --- a/pandas/plotting/_matplotlib/boxplot.py +++ b/pandas/plotting/_matplotlib/boxplot.py @@ -251,7 +251,7 @@ def _make_plot(self, fig: Figure) -> None: def _make_legend(self) -> None: pass - def _post_plot_logic(self, ax, data) -> None: + def _post_plot_logic(self, ax: Axes, data) -> None: # GH 45465: make sure that the boxplot doesn't ignore xlabel/ylabel if self.xlabel: ax.set_xlabel(pprint_thing(self.xlabel)) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index aa7d584ba267e..eaa7c11fc7234 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -477,7 +477,7 @@ def _has_plotted_object(ax: Axes) -> bool: return len(ax.lines) != 0 or len(ax.artists) != 0 or len(ax.containers) != 0 @final - def _maybe_right_yaxis(self, ax: Axes, axes_num: int): + def _maybe_right_yaxis(self, ax: Axes, axes_num: int) -> Axes: if not self.on_right(axes_num): # secondary axes may be passed via ax kw return self._get_ax_layer(ax) @@ -666,7 +666,7 @@ def _add_table(self) -> None: tools.table(ax, data) @final - def _post_plot_logic_common(self, ax, data): + def _post_plot_logic_common(self, ax: Axes, data) -> None: """Common post process for each axes""" if self.orientation == "vertical" or self.orientation is None: self._apply_axis_properties(ax.xaxis, rot=self.rot, fontsize=self.fontsize) @@ -685,7 +685,7 @@ def _post_plot_logic_common(self, ax, data): raise ValueError @abstractmethod - def _post_plot_logic(self, ax, data) -> None: + def _post_plot_logic(self, ax: Axes, data) -> None: """Post process for each axes. Overridden in child classes""" @final @@ -1039,7 +1039,7 @@ def _get_colors( ) @final - def _parse_errorbars(self, label, err): + def _parse_errorbars(self, label: str, err): """ Look for error keyword arguments and return the actual errorbar data or return the error DataFrame/dict @@ -1835,7 +1835,14 @@ def _post_plot_logic(self, ax: Axes, data) -> None: self._decorate_ticks(ax, self._get_index_name(), str_index, s_edge, e_edge) - def _decorate_ticks(self, ax: Axes, name, ticklabels, start_edge, end_edge) -> None: + def _decorate_ticks( + self, + ax: Axes, + name: str | None, + ticklabels: list[str], + start_edge: float, + end_edge: float, + ) -> None: ax.set_xlim((start_edge, end_edge)) if self.xticks is not None: @@ -1880,7 +1887,14 @@ def _plot( # type: ignore[override] def _get_custom_index_name(self): return self.ylabel - def _decorate_ticks(self, ax: Axes, name, ticklabels, start_edge, end_edge) -> None: + def _decorate_ticks( + self, + ax: Axes, + name: str | None, + ticklabels: list[str], + start_edge: float, + end_edge: float, + ) -> None: # horizontal bars ax.set_ylim((start_edge, end_edge)) ax.set_yticks(self.tick_pos) diff --git a/pandas/plotting/_matplotlib/hist.py b/pandas/plotting/_matplotlib/hist.py index a2ab1c9409841..ed93dc740e1b4 100644 --- a/pandas/plotting/_matplotlib/hist.py +++ b/pandas/plotting/_matplotlib/hist.py @@ -269,7 +269,7 @@ def _make_plot_keywords(self, kwds: dict[str, Any], y: np.ndarray) -> None: kwds["bw_method"] = self.bw_method kwds["ind"] = self._get_ind(y, ind=self.ind) - def _post_plot_logic(self, ax, data) -> None: + def _post_plot_logic(self, ax: Axes, data) -> None: ax.set_ylabel("Density") From 098dba6e32fc75b72543b3024165d54d0db6cefe Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 7 Nov 2023 19:16:08 -0800 Subject: [PATCH 4/9] TYP: plotting --- pandas/plotting/_matplotlib/timeseries.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandas/plotting/_matplotlib/timeseries.py b/pandas/plotting/_matplotlib/timeseries.py index e3e02c69a26db..6b00a880e91b2 100644 --- a/pandas/plotting/_matplotlib/timeseries.py +++ b/pandas/plotting/_matplotlib/timeseries.py @@ -5,6 +5,7 @@ import functools from typing import ( TYPE_CHECKING, + Any, cast, ) import warnings @@ -56,7 +57,7 @@ # Plotting functions and monkey patches -def maybe_resample(series: Series, ax: Axes, kwargs): +def maybe_resample(series: Series, ax: Axes, kwargs: dict[str, Any]): # resample against axes freq if necessary freq, ax_freq = _get_freq(ax, series) @@ -99,7 +100,7 @@ def _is_sup(f1: str, f2: str) -> bool: ) -def _upsample_others(ax: Axes, freq, kwargs) -> None: +def _upsample_others(ax: Axes, freq: BaseOffset, kwargs: dict[str, Any]) -> None: legend = ax.get_legend() lines, labels = _replot_ax(ax, freq, kwargs) _replot_ax(ax, freq, kwargs) @@ -122,7 +123,7 @@ def _upsample_others(ax: Axes, freq, kwargs) -> None: ax.legend(lines, labels, loc="best", title=title) -def _replot_ax(ax: Axes, freq, kwargs): +def _replot_ax(ax: Axes, freq: BaseOffset, kwargs: dict[str, Any]): data = getattr(ax, "_plot_data", None) # clear current axes and data @@ -152,7 +153,7 @@ def _replot_ax(ax: Axes, freq, kwargs): return lines, labels -def decorate_axes(ax: Axes, freq, kwargs) -> None: +def decorate_axes(ax: Axes, freq: BaseOffset, kwargs: dict[str, Any]) -> None: """Initialize axes for time-series plotting""" if not hasattr(ax, "_plot_data"): ax._plot_data = [] From fa171467a3cb8870dc725aea69a42146e36efc37 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 8 Nov 2023 15:17:21 -0800 Subject: [PATCH 5/9] Improve check --- pandas/plotting/_matplotlib/core.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index eaa7c11fc7234..49c4ae59cc56a 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -640,11 +640,7 @@ def _compute_plot_data(self): numeric_data = data.select_dtypes(include=include_type, exclude=exclude_type) - try: - is_empty = numeric_data.columns.empty - except AttributeError: - is_empty = not len(numeric_data) - + is_empty = numeric_data.shape[-1] == 0 # no non-numeric frames or series allowed if is_empty: raise TypeError("no numeric data to plot") From a5468219c27bfe885fe9db5baef1fe37f6bae689 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 8 Nov 2023 15:42:35 -0800 Subject: [PATCH 6/9] TYP: plotting --- pandas/plotting/_core.py | 16 ++++++++++------ pandas/plotting/_matplotlib/timeseries.py | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 3b60e95b9dceb..a017787f2dc2d 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -37,11 +37,15 @@ from pandas._typing import IndexLabel - from pandas import DataFrame + from pandas import ( + DataFrame, + Series, + ) + from pandas.core.groupby.generic import DataFrameGroupBy def hist_series( - self, + self: Series, by=None, ax=None, grid: bool = True, @@ -512,7 +516,7 @@ def boxplot( @Substitution(data="", backend=_backend_doc) @Appender(_boxplot_doc) def boxplot_frame( - self, + self: DataFrame, column=None, by=None, ax=None, @@ -542,7 +546,7 @@ def boxplot_frame( def boxplot_frame_groupby( - grouped, + grouped: DataFrameGroupBy, subplots: bool = True, column=None, fontsize: int | None = None, @@ -843,11 +847,11 @@ class PlotAccessor(PandasObject): _kind_aliases = {"density": "kde"} _all_kinds = _common_kinds + _series_kinds + _dataframe_kinds - def __init__(self, data) -> None: + def __init__(self, data: Series | DataFrame) -> None: self._parent = data @staticmethod - def _get_call_args(backend_name: str, data, args, kwargs): + def _get_call_args(backend_name: str, data: Series | DataFrame, args, kwargs): """ This function makes calls to this accessor `__call__` method compatible with the previous `SeriesPlotMethods.__call__` and diff --git a/pandas/plotting/_matplotlib/timeseries.py b/pandas/plotting/_matplotlib/timeseries.py index 6b00a880e91b2..714ee9d162a25 100644 --- a/pandas/plotting/_matplotlib/timeseries.py +++ b/pandas/plotting/_matplotlib/timeseries.py @@ -45,6 +45,8 @@ from matplotlib.axes import Axes + from pandas._typing import NDFrameT + from pandas import ( DataFrame, DatetimeIndex, @@ -265,7 +267,7 @@ def _get_index_freq(index: Index) -> BaseOffset | None: return freq -def maybe_convert_index(ax: Axes, data): +def maybe_convert_index(ax: Axes, data: NDFrameT) -> NDFrameT: # tsplot converts automatically, but don't want to convert index # over and over for DataFrames if isinstance(data.index, (ABCDatetimeIndex, ABCPeriodIndex)): From a6da11163e10390f73b4211e68af6b4708e973c0 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 8 Nov 2023 18:02:39 -0800 Subject: [PATCH 7/9] lint fixup --- pandas/plotting/_matplotlib/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index 49c4ae59cc56a..d73d631994996 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -433,7 +433,9 @@ def _validate_color_args(self): @final @staticmethod - def _iter_data(data: DataFrame) -> Iterator[tuple[Hashable, np.ndarray]]: + def _iter_data( + data: DataFrame | dict[Hashable, Series | DataFrame] + ) -> Iterator[tuple[Hashable, np.ndarray]]: for col, values in data.items(): # This was originally written to use values.values before EAs # were implemented; adding np.asarray(...) to keep consistent From 6059d3594a992ce680cdd981db9a97ce3da20d34 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 8 Nov 2023 19:28:03 -0800 Subject: [PATCH 8/9] mypy fixup --- pandas/plotting/_matplotlib/groupby.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/plotting/_matplotlib/groupby.py b/pandas/plotting/_matplotlib/groupby.py index 75b2bbf4d8750..d32741a1d1803 100644 --- a/pandas/plotting/_matplotlib/groupby.py +++ b/pandas/plotting/_matplotlib/groupby.py @@ -16,12 +16,14 @@ from pandas.plotting._matplotlib.misc import unpack_single_str_list if TYPE_CHECKING: + from collections.abc import Hashable + from pandas._typing import IndexLabel def create_iter_data_given_by( data: DataFrame, kind: str = "hist" -) -> dict[str, DataFrame | Series]: +) -> dict[Hashable, DataFrame | Series]: """ Create data for iteration given `by` is assigned or not, and it is only used in both hist and boxplot. From 10bf601a93f935705140c3938b902d994b51ffe2 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 8 Nov 2023 20:25:28 -0800 Subject: [PATCH 9/9] pyright fixup --- pandas/plotting/_matplotlib/core.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index d73d631994996..c2b0f43d83e60 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -1118,7 +1118,10 @@ def match_labels(data, e): err = np.tile(err, (self.nseries, 1)) elif is_number(err): - err = np.tile([err], (self.nseries, len(self.data))) + err = np.tile( + [err], # pyright: ignore[reportGeneralTypeIssues] + (self.nseries, len(self.data)), + ) else: msg = f"No valid {label} detected" @@ -1415,7 +1418,12 @@ def _make_plot(self, fig: Figure) -> None: for i, (label, y) in enumerate(it): ax = self._get_ax(i) kwds = self.kwds.copy() - style, kwds = self._apply_style_colors(colors, kwds, i, label) + style, kwds = self._apply_style_colors( + colors, + kwds, + i, + label, # pyright: ignore[reportGeneralTypeIssues] + ) errors = self._get_errorbars(label=label, index=i) kwds = dict(kwds, **errors) @@ -1427,7 +1435,7 @@ def _make_plot(self, fig: Figure) -> None: newlines = plotf( ax, x, - y, + y, # pyright: ignore[reportGeneralTypeIssues] style=style, column_num=i, stacking_id=stacking_id,