Exemple #1
0
    def bar_with_sma_line(self,
                          ax: _figure.Axes,
                          values: _pd.Series,
                          sma_window: int = 7,
                          label: str = None,
                          bar_alpha: float = 0.3,
                          color: str = None):
        if label:
            ax.plot(values.rolling(window=sma_window).mean(),
                    label=label + "-SMA" + str(sma_window),
                    color=color)
        else:
            ax.plot(values.rolling(window=sma_window).mean(), color=color)

        ax.bar(values.index, values, alpha=bar_alpha, color=color)
Exemple #2
0
    def _draw_daily_stats(self, ax: _figure.Axes, df: _pd.DataFrame,
                          draw_key_dates: bool):
        index = df.index
        confirmed_daily = df.Confirmed_Change
        recovered_daily = df.Recovered_Change
        deaths_daily = df.Deaths_Change

        self.bar_with_sma_line(ax, confirmed_daily, label="Заболевшие")
        self.bar_with_sma_line(ax, recovered_daily, label="Выздоровевшие")

        ax.bar(index,
               deaths_daily,
               label='Смерти',
               alpha=0.3,
               bottom=recovered_daily)
        ax.plot(index,
                (recovered_daily + deaths_daily).rolling(window=7).mean(),
                label='Смерти-SMA7')

        self._setup_axes_for_russian_regions_stat(
            ax, "Статистика день ко дню", draw_key_dates=draw_key_dates)
Exemple #3
0
    def _draw_stats_bar(self, ax: _figure.Axes, df: _pd.DataFrame):
        index = df.index
        confirmed = df.Confirmed_Change
        recovered = df.Recovered_Change
        deaths = df.Deaths_Change
        one_day = self.__dates.to_Timedelta(1)

        ax.bar(index, confirmed, label='Заболевшие', width=2)
        ax.bar(index + one_day, recovered, label='Выздоровевшие', width=2)
        ax.bar(index + one_day * 2, deaths, label='Смерти', width=2)