Exemple #1
0
    def plot(self) -> Chart:
        df = StyleAnalysis(self.style).popular_fermentables_amount(
            type_filter=self.filter_param)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'fermentable',
                                             'amount_percent', None,
                                             '% of Weight in Recipe')
        return Chart(figure, title=self.get_chart_title())
Exemple #2
0
    def plot(self) -> Chart:
        (categories, types) = self.get_filter()
        df = get_style_popular_fermentables(self.style, categories, types)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'fermentable',
                                             'amount_percent',
                                             'Fermentables by Popularity',
                                             '% Amount')
        return Chart(figure, title=self.get_chart_title())
Exemple #3
0
    def plot(self) -> Chart:
        analysis = RecipesTrendAnalysis(self.recipe_scope)
        df = analysis.trending_styles(trend_window_months=24)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent',
                                                    'beer_style', None,
                                                    '% of All Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #4
0
    def plot(self) -> Chart:
        df = YeastAnalysis(self.yeast).popular_hops()
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent', 'hop',
                                                    None, '% of Yeast Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
Exemple #5
0
    def plot(self) -> Chart:
        projection = YeastProjection()
        if self.filter_param in YEAST_FILTER_TO_TYPES:
            projection.types = YEAST_FILTER_TO_TYPES[self.filter_param]

        analysis = RecipesPopularityAnalysis(RecipeScope())
        df = analysis.popularity_per_yeast(projection, num_top=8, top_months=self.period_months)
        if len(df) <= 1:  # 1, because a single data point is also meaningless
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month', 'recipes_percent', 'yeast', 'Month/Year', '% of All Recipes')
        return Chart(figure, height=Chart.DEFAULT_HEIGHT * 0.66, title=self.get_chart_title())
Exemple #6
0
    def plot(self) -> Chart:
        projection = YeastProjection()
        if self.filter_param in YEAST_FILTER_TO_TYPES:
            projection.types = YEAST_FILTER_TO_TYPES[self.filter_param]

        analysis = RecipesTrendAnalysis(RecipeScope())
        df = analysis.trending_yeasts(projection, trend_window_months=self.period_months)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month', 'recipes_percent', 'yeast', None, '% of All Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #7
0
    def plot(self) -> Chart:
        df = StyleAnalysis(
            self.style).popular_hops(use_filter=self.filter_param)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent', 'hop',
                                                    None, '% of Style Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
Exemple #8
0
    def plot(self) -> Chart:
        analysis = RecipesPopularityAnalysis(self.recipe_scope)
        df = analysis.popularity_per_hop(num_top=8, top_months=24)
        if len(df) <= 1:  # 1, because a single data point is also meaningless
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent', 'hop',
                                                    'Month/Year',
                                                    '% of All Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
Exemple #9
0
    def plot(self) -> Chart:
        analysis = RecipesPopularityAnalysis(self.recipe_scope)
        df = analysis.popularity_per_fermentable(num_top=8)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent',
                                                    'fermentable', None,
                                                    '% of Style Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())