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

Method _make_plot

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

Source from the content-addressed store, hash-verified

1551 self.data = self.data.fillna(value=0)
1552
1553 def _make_plot(self, fig: Figure) -> None:
1554 if self._is_ts_plot():
1555 data = maybe_convert_index(self._get_ax(0), self.data)
1556
1557 x = data.index # dummy, not used
1558 plotf = self._ts_plot
1559 it = data.items()
1560 else:
1561 x = self._get_xticks()
1562 # error: Incompatible types in assignment (expression has type
1563 # "Callable[[Any, Any, Any, Any, Any, Any, KwArg(Any)], Any]", variable has
1564 # type "Callable[[Any, Any, Any, Any, KwArg(Any)], Any]")
1565 plotf = self._plot # type: ignore[assignment]
1566 # error: Incompatible types in assignment (expression has type
1567 # "Iterator[tuple[Hashable, ndarray[Any, Any]]]", variable has
1568 # type "Iterable[tuple[Hashable, Series]]")
1569 it = self._iter_data(data=self.data) # type: ignore[assignment]
1570
1571 stacking_id = self._get_stacking_id()
1572 is_errorbar = com.any_not_none(*self.errors.values())
1573
1574 colors = self._get_colors()
1575 for i, (label, y) in enumerate(it):
1576 ax = self._get_ax(i)
1577 kwds = self.kwds.copy()
1578 if self.color is not None:
1579 kwds["color"] = self.color
1580 style, kwds = self._apply_style_colors(
1581 colors,
1582 kwds,
1583 i,
1584 # error: Argument 4 to "_apply_style_colors" of "MPLPlot" has
1585 # incompatible type "Hashable"; expected "str"
1586 label, # type: ignore[arg-type]
1587 )
1588
1589 errors = self._get_errorbars(label=label, index=i)
1590 kwds = dict(kwds, **errors)
1591
1592 label = pprint_thing(label)
1593 label = self._mark_right_label(label, index=i)
1594 kwds["label"] = label
1595
1596 newlines = plotf(
1597 ax,
1598 x,
1599 y,
1600 style=style,
1601 column_num=i,
1602 stacking_id=stacking_id,
1603 is_errorbar=is_errorbar,
1604 **kwds,
1605 )
1606 self._append_legend_handles_labels(newlines[0], label)
1607
1608 if self._is_ts_plot():
1609 # reset of xlim should be used for ts data
1610 # TODO: GH28021, should find a way to change view limit on xaxis

Callers

nothing calls this directly

Calls 15

_get_stacking_idMethod · 0.95
maybe_convert_indexFunction · 0.90
pprint_thingFunction · 0.90
get_all_linesFunction · 0.90
get_xlimFunction · 0.90
_is_ts_plotMethod · 0.80
_get_axMethod · 0.80
_get_xticksMethod · 0.80
_iter_dataMethod · 0.80
_apply_style_colorsMethod · 0.80
_get_errorbarsMethod · 0.80
_mark_right_labelMethod · 0.80

Tested by

no test coverage detected