Beispiel #1
0
    def create_legend(self):
        '''Takes an object from the bubble chart data class and creates an appropriate legend. Must be called after process data'''
        grouped_by_color = util.group_by_columns(self.new_data,
                                                 [self.color, 'color'],
                                                 self.bubble_id)
        counted_by_color = util.count_by_groups(grouped_by_color)
        counted_by_color.reset_index(inplace=True)

        colors_legend = {}

        for i in range(0, len(counted_by_color)):
            colors_legend[counted_by_color[self.color][i]] = cm.viridis(
                counted_by_color['color'][i])

        return colors_legend
Beispiel #2
0
 def count_by_group(self):
     '''Returns the sum by groups (ignores user filters)'''
     return util.count_by_groups(self.groups)
Beispiel #3
0
 def count_by_subgroup(self):
     '''Uses group from init function to create a count'''
     return util.count_by_groups(self.subgroups)