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

Method _make_plot

pandas/plotting/_matplotlib/core.py:1931–2041  ·  view source on GitHub ↗
(self, fig: Figure)

Source from the content-addressed store, hash-verified

1929 return self.bottom
1930
1931 def _make_plot(self, fig: Figure) -> None:
1932 colors = self._get_colors()
1933 ncolors = len(colors)
1934
1935 pos_prior = neg_prior = np.zeros(len(self.data))
1936 K = self.nseries
1937
1938 data = self.data.fillna(0)
1939
1940 _stacked_subplots_ind: dict[int, int] = {}
1941 _stacked_subplots_offsets: list[tuple[np.ndarray, np.ndarray]] = []
1942
1943 self.subplots: list[Any]
1944
1945 if not isinstance(self.subplots, bool):
1946 if bool(self.subplots) and self.stacked:
1947 for i, sub_plot in enumerate(self.subplots):
1948 if len(sub_plot) <= 1:
1949 continue
1950 for plot in sub_plot:
1951 _stacked_subplots_ind[int(plot)] = i
1952 _stacked_subplots_offsets.append((pos_prior, neg_prior))
1953
1954 for i, (label, y) in enumerate(self._iter_data(data=data)):
1955 ax = self._get_ax(i)
1956 kwds = self.kwds.copy()
1957 if self._is_series:
1958 kwds["color"] = colors
1959 elif isinstance(colors, dict):
1960 kwds["color"] = colors[label]
1961 else:
1962 kwds["color"] = colors[i % ncolors]
1963
1964 errors = self._get_errorbars(label=label, index=i)
1965 kwds = dict(kwds, **errors)
1966
1967 label = pprint_thing(label)
1968 label = self._mark_right_label(label, index=i)
1969
1970 if (("yerr" in kwds) or ("xerr" in kwds)) and (kwds.get("ecolor") is None):
1971 kwds["ecolor"] = mpl.rcParams["xtick.color"]
1972
1973 start = 0
1974 if self.log and (y >= 1).all():
1975 start = 1
1976 start = start + self._start_base
1977
1978 kwds["align"] = self._align
1979
1980 if i in _stacked_subplots_ind:
1981 offset_index = _stacked_subplots_ind[i]
1982 pos_prior, neg_prior = _stacked_subplots_offsets[offset_index]
1983 mask = y >= 0
1984 start = np.where(mask, pos_prior, neg_prior) + self._start_base
1985 w = self.bar_width / 2
1986 rect = self._plot(
1987 ax,
1988 self.ax_pos + w,

Callers

nothing calls this directly

Calls 14

_plotMethod · 0.95
pprint_thingFunction · 0.90
_iter_dataMethod · 0.80
_get_axMethod · 0.80
_get_errorbarsMethod · 0.80
_mark_right_labelMethod · 0.80
_get_colorsMethod · 0.45
fillnaMethod · 0.45
appendMethod · 0.45
copyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected