MCPcopy
hub / github.com/pandas-dev/pandas / _plot

Method _plot

pandas/plotting/_matplotlib/core.py:1777–1820  ·  view source on GitHub ↗
(  # type: ignore[override]
        cls,
        ax: Axes,
        x,
        y: np.ndarray,
        style=None,
        column_num=None,
        stacking_id=None,
        is_errorbar: bool = False,
        **kwds,
    )

Source from the content-addressed store, hash-verified

1775 # error: Signature of "_plot" incompatible with supertype "MPLPlot"
1776 @classmethod
1777 def _plot( # type: ignore[override]
1778 cls,
1779 ax: Axes,
1780 x,
1781 y: np.ndarray,
1782 style=None,
1783 column_num=None,
1784 stacking_id=None,
1785 is_errorbar: bool = False,
1786 **kwds,
1787 ):
1788 if column_num == 0:
1789 cls._initialize_stacker(ax, stacking_id, len(y))
1790 y_values = cls._get_stacked_values(ax, stacking_id, y, kwds["label"])
1791
1792 # need to remove label, because subplots uses mpl legend as it is
1793 line_kwds = kwds.copy()
1794 line_kwds.pop("label")
1795 lines = MPLPlot._plot(ax, x, y_values, style=style, **line_kwds)
1796
1797 # get data from the line to get coordinates for fill_between
1798 xdata, y_values = lines[0].get_data(orig=False)
1799
1800 # unable to use ``_get_stacked_values`` here to get starting point
1801 if stacking_id is None:
1802 start = np.zeros(len(y))
1803 elif (y >= 0).all():
1804 # TODO #54485
1805 start = ax._stacker_pos_prior[stacking_id] # type: ignore[attr-defined]
1806 elif (y <= 0).all():
1807 # TODO #54485
1808 start = ax._stacker_neg_prior[stacking_id] # type: ignore[attr-defined]
1809 else:
1810 start = np.zeros(len(y))
1811
1812 if "color" not in kwds:
1813 kwds["color"] = lines[0].get_color()
1814
1815 rect = ax.fill_between(xdata, start, y_values, **kwds)
1816 cls._update_stacker(ax, stacking_id, y)
1817
1818 # LinePlot expects list of artists
1819 res = [rect]
1820 return res
1821
1822 def _post_plot_logic(self, ax: Axes, data) -> None:
1823 LinePlot._post_plot_logic(self, ax, data)

Callers

nothing calls this directly

Calls 7

_initialize_stackerMethod · 0.80
_get_stacked_valuesMethod · 0.80
_update_stackerMethod · 0.80
copyMethod · 0.45
popMethod · 0.45
_plotMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected