def __init__(self, *args, **kwargs):

        super(Bar, self).__init__(*args, **kwargs)

        # Scales
        self.scales += [
            Scale(name='x', type='ordinal', range='width', zero=False,
                  domain=DataRef(data='table', field='data.idx')),
            Scale(name='y', range='height', nice=True,
                  domain=DataRef(data='stats', field='sum')),
            Scale(name='color', type='ordinal', range='category20',
                  domain=DataRef(data='table', field='data.col'))
        ]

        # Axes
        self.axes += [Axis(type='x', scale='x'),
                      Axis(type='y', scale='y')]

        # Stats Data
        stats_transform = [Transform(type='facet', keys=['data.idx']),
                           Transform(type='stats', value='data.val')]
        stats_data = Data(name='stats', source='table',
                          transform=stats_transform)
        self.data.append(stats_data)

        # Marks
        from_transform = [
            Transform(type='facet', keys=['data.col']),
            Transform(type='stack', point='data.idx', height='data.val')
        ]
        from_ = MarkRef(data='table', transform=from_transform)
        enter_props = PropertySet(
            x=ValueRef(scale='x', field='data.idx'),
            y=ValueRef(scale='y', field='y'),
            y2=ValueRef(scale='y', field='y2'),
            width=ValueRef(scale='x', band=True, offset=-1),
            fill=ValueRef(scale='color', field='data.col'))
        marks = [Mark(type='rect',
                      properties=MarkProperties(enter=enter_props))]
        mark_group = Mark(type='group', from_=from_, marks=marks)
        self.marks.append(mark_group)
Create a Vega Bar Chart
dataset/ETHPy150Open wrobstory/vincent/vincent/charts.py/Bar.__init__