import numpy as np import holoviews as hv hv.extension('matplotlib') data = [('one',8),('two', 10), ('three', 16), ('four', 8), ('five', 4), ('six', 1)] bars = hv.Bars(data, hv.Dimension('Car occupants'), 'Count') bars bars[['one', 'two', 'three']] + bars[['four', 'five', 'six']] occupants = hv.Dimension('Car occupants', values=['three', 'two', 'four', 'one', 'five', 'six']) # or using .redim.values(**{'Car Occupants': ['three', 'two', 'four', 'one', 'five', 'six']}) hv.Bars(data, occupants, 'Count') samples = 100 pets = ['Cat', 'Dog', 'Hamster', 'Rabbit'] genders = ['Female', 'Male'] pets_sample = np.random.choice(pets, samples) gender_sample = np.random.choice(genders, samples) bars = hv.Bars((pets_sample, gender_sample, np.ones(samples)), ['Pets', 'Gender']).aggregate(function=np.sum) bars.opts(fig_size=300, aspect=2) (bars.redim.values(Pets=pets, Gender=genders) + bars.sort()).opts(fig_size=300) (bars.sort() + bars.clone().opts(multi_level=False)).opts(fig_size=300) bars.opts(stacked=True)