Пример #1
0
    def _make_plot(self):
        # TODO: this logic is similar with KdePlot. Might have to deduplicate it.
        # 'num_colors' requires to calculate `shape` which has to count all.
        # Use 1 for now to save the computation.
        colors = self._get_colors(num_colors=1)
        stacking_id = self._get_stacking_id()
        output_series = HistogramPlotBase.compute_hist(self.data, self.bins)

        for (i, label), y in zip(enumerate(self.data._internal.column_labels),
                                 output_series):
            ax = self._get_ax(i)

            kwds = self.kwds.copy()

            label = pprint_thing(label if len(label) > 1 else label[0])
            # `if hasattr(...)` makes plotting compatible with pandas < 1.3,
            # see pandas-dev/pandas#40078.
            label = (self._mark_right_label(label, index=i) if hasattr(
                self, "_mark_right_label") else label)
            kwds["label"] = label

            style, kwds = self._apply_style_colors(colors, kwds, i, label)
            if style is not None:
                kwds["style"] = style

            kwds = self._make_plot_keywords(kwds, y)
            artists = self._plot(ax,
                                 y,
                                 column_num=i,
                                 stacking_id=stacking_id,
                                 **kwds)
            # `if hasattr(...)` makes plotting compatible with pandas < 1.3,
            # see pandas-dev/pandas#40078.
            self._append_legend_handles_labels(artists[0], label) if hasattr(
                self,
                "_append_legend_handles_labels") else self._add_legend_handle(
                    artists[0], label, index=i)
Пример #2
0
 def _compute_plot_data(self):
     self.data, self.bins = HistogramPlotBase.prepare_hist_data(
         self.data, self.bins)