Exemple #1
0
    def plot(self) -> Chart:
        df = FermentableAnalysis(self.fermentable).common_styles_absolute()
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart().plot(df, 'beer_style', 'recipes', None, 'Total Number of Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #2
0
    def plot(self) -> Chart:
        df = FermentableAnalysis(self.fermentable).popularity()
        if len(df) <= 1:  # 1, because a single data point is also meaningless
            raise NoDataException()

        figure = LinesChart().plot(df, 'month', 'recipes_percent', 'fermentable', 'Month/Year', '% of All Recipes')
        return Chart(figure, height=Chart.DEFAULT_HEIGHT * 0.66, title=self.get_chart_title())
Exemple #3
0
    def plot(self) -> Chart:
        df = FermentableAnalysis(self.fermentable).amount_per_style()
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'beer_style', 'amount_percent', 'Style', '% of Weight in Recipe')
        return Chart(figure, title=self.get_chart_title())
Exemple #4
0
    def plot(self) -> Chart:
        df = FermentableAnalysis(self.fermentable).common_styles_relative()
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart().plot(df, 'beer_style', 'recipes_percent', None, 'Used in % of the Style\'s Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #5
0
    def plot(self) -> Chart:
        df = HopAnalysis(self.hop).amount_range()
        if len(df) == 0:
            raise NoDataException()

        figure = RangeBoxPlot().plot(df, 'amount_percent')
        return Chart(figure, 500, 350, title=self.get_chart_title())
Exemple #6
0
    def plot(self) -> Chart:
        df = get_fermentable_amount_range(self.fermentable)
        if len(df) == 0:
            raise NoDataException()

        figure = RangeBoxPlot().plot(df, 'amount_percent')
        return Chart(figure, 500, 350, title=self.get_chart_title())
Exemple #7
0
    def plot(self) -> Chart:
        df = HopAnalysis(self.hop).metric_histogram('beta')
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregateHistogramChart().plot(df, 'beta', 'count')
        return Chart(figure, 500, 350, title=self.get_chart_title())
Exemple #8
0
    def plot(self) -> Chart:
        df = get_style_metric_values(self.style, 'fg')
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregateHistogramChart().plot(df, 'fg', 'count')
        return Chart(figure, 500, 350, title=self.get_chart_title())
Exemple #9
0
    def plot(self) -> Chart:
        df = FermentableAnalysis(self.fermentable).metric_histogram('color_lovibond')
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregateHistogramChart().plot(df, 'color_lovibond', 'count')
        return Chart(figure, 500, 350, title=self.get_chart_title())
Exemple #10
0
    def plot(self) -> Chart:
        df = get_hop_amount_range_per_use(self.hop)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'use', 'amount_percent',
                                             'Usage', '% Amount')
        return Chart(figure, title=self.get_chart_title())
Exemple #11
0
    def plot(self) -> Chart:
        df = get_hop_usage(self.hop)
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart(add_margin=False).plot(df, 'use', 'recipes', None,
                                                 None)
        return Chart(figure, 500, 350, title=self.get_chart_title())
Exemple #12
0
    def plot(self) -> Chart:
        analysis = RecipesTrendAnalysis(RecipeScope())
        df = analysis.trending_styles(trend_window_months=self.period_months)
        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 #13
0
    def plot(self) -> Chart:
        df = get_fermentable_common_styles_absolute(self.fermentable)
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart().plot(df, 'style_name', 'recipes', 'Style',
                                 'Number Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #14
0
    def plot(self) -> Chart:
        df = get_fermentable_common_styles_relative(self.fermentable)
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart().plot(df, 'style_name', 'recipes_percent', 'Style',
                                 'Used in % Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #15
0
    def plot(self) -> Chart:
        df = HopAnalysis(self.hop).amount_per_use()
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'use', 'amount_percent',
                                             'Usage', '% of Weight in Recipe')
        return Chart(figure, title=self.get_chart_title())
Exemple #16
0
    def plot(self) -> Chart:
        df = get_fermentable_amount_range_per_style(self.fermentable)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'style', 'amount_percent',
                                             'Style', '% Amount')
        return Chart(figure, title=self.get_chart_title())
Exemple #17
0
    def plot(self) -> Chart:
        df = get_style_popular_hops(self.style, self.get_use_filter())
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'hop', 'amount_percent',
                                             'Hops by Popularity', '% Amount')
        return Chart(figure, title=self.get_chart_title())
Exemple #18
0
    def plot(self) -> Chart:
        analysis = RecipesPopularityAnalysis(RecipeScope())
        df = analysis.popularity_per_style(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', 'beer_style', 'Month/Year', '% of All Recipes')
        return Chart(figure, height=Chart.DEFAULT_HEIGHT * 0.66, title=self.get_chart_title())
Exemple #19
0
    def plot(self) -> Chart:
        df = get_style_trending_hops(self.style)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart().plot(df, 'month', 'recipes_percent', 'hop',
                                   'Month/Year', '% Style Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #20
0
    def plot(self) -> Chart:
        df = HopAnalysis(self.hop).pairings()
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedPairsBoxPlot().plot(df, 'pairing', 'hop',
                                                  'amount_percent', None,
                                                  '% of Weight in Recipe')
        return Chart(figure, title=self.get_chart_title())
Exemple #21
0
    def plot(self) -> Chart:
        df = YeastAnalysis(self.yeast).trending_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, title=self.get_chart_title())
Exemple #22
0
    def plot(self) -> Chart:
        analysis = HopAmountAnalysis(self.recipe_scope)
        df = analysis.per_hop(num_top=8)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'hop', 'amount_percent', None,
                                             '% of Weight in Recipe')
        return Chart(figure, title=self.get_chart_title())
Exemple #23
0
    def plot(self) -> Chart:
        analysis = CommonStylesAnalysis(self.recipe_scope)
        df = analysis.common_styles_absolute(num_top=20)
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart().plot(df, 'beer_style', 'recipes', None,
                                 'Total Number of Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #24
0
    def plot(self) -> Chart:
        analysis = CommonStylesAnalysis(self.recipe_scope)
        df = analysis.common_styles_relative(num_top=20)
        if len(df) == 0:
            raise NoDataException()

        figure = BarChart().plot(df, 'beer_style', 'recipes_percent', None,
                                 '% of the Style\'s Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #25
0
    def plot(self) -> Chart:
        df = get_fermentable_pairing_fermentables(self.fermentable)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedPairsBoxPlot().plot(df, 'pairing', 'fermentable',
                                                  'amount_percent', None,
                                                  '% Amount')
        return Chart(figure, title=self.get_chart_title())
Exemple #26
0
    def plot(self) -> Chart:
        df = StyleAnalysis(
            self.style).popular_hops_amount(use_filter=self.filter_param)
        if len(df) == 0:
            raise NoDataException()

        figure = PreAggregatedBoxPlot().plot(df, 'hop', 'amount_percent', None,
                                             '% of Weight in Recipe')
        return Chart(figure, title=self.get_chart_title())
    def plot(self) -> Chart:
        df = get_most_popular_hops()
        if len(df) <= 1:  # 1, because a single data point is also meaningless
            raise NoDataException()

        figure = LinesChart().plot(df, 'month', 'recipes_percent', 'hop',
                                   'Month/Year', '% Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
Exemple #28
0
    def plot(self) -> Chart:
        analysis = RecipesTrendAnalysis(self.recipe_scope)
        df = analysis.trending_hops(trend_window_months=24)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent', 'hop',
                                                    None, '% of All Recipes')
        return Chart(figure, title=self.get_chart_title())
Exemple #29
0
    def plot(self) -> Chart:
        df = HopAnalysis(self.hop).popular_yeasts()
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent', 'yeast',
                                                    None, '% of Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
Exemple #30
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())